ASP.NET MVC: Routing
Posted
by JamesBrownIsDead
on Stack Overflow
See other posts from Stack Overflow
or by JamesBrownIsDead
Published on 2010-05-28T01:52:52Z
Indexed on
2010/05/28
2:01 UTC
Read the original article
Hit count: 306
Let's say I have this Controller:
public class GlobalizationController : Controller
{
public JavaScriptResult GlobalizedLabels(string virtualPath)
{
return new JavaScriptResult();
}
}
I want the controller to handle (i.e. invoke from) any of the relative URLs below:
- /globalization/~Enlargement/Controls/Container.ascx
- /globalization/test/foobar.aspx
- /globalization/HappyTimes/Are/Right/Now
What would my entry in global.asax routes.MapRoute()
entry look like? As in...
routes.MapRoute("Globalization", "globalization/{virtualPath}", new
{
controller = "Globalization",
action = "GlobalizedLabels"
});
The URL pattern "{virtualPath}" is wrong. What should it be?
© Stack Overflow or respective owner