1

I have a situation where I am pulling a web page from a 3rd party source and replacing all the links with links to my own page then displaying it with a Response.Write.

So, for example, the page I'm pulling might have:

<a href="http://www.thirdparty.com/a/b/c.html">Click Here!</a>

I modify this to

<a href="http://www.mysite.com/x/b/c.html">Click Here!"</a>

However, if they press Click Here, it's not routing to my controller. I'm assuming because /b isn't in my route table.

How do I set up my route so that http://www.mysite.com/x ALWAYS goes to a specific controller, regardless of what comes after it?

Scottie
  • 11,050
  • 19
  • 68
  • 109

1 Answers1

1

Infinite URL Parameters for ASP.NET MVC Route

Looks like you can do something like this:

routes.MapRoute(
    name: "x",
    url: "x/{*tags}",
    defaults: new { controller = "x", action = "Index" }
);

The {*tags} lets you specify an unlimited number of /'s.

Community
  • 1
  • 1
Scottie
  • 11,050
  • 19
  • 68
  • 109