is there any way to find out to which route my url is getting mapped in asp.net mvc.
+2
A:
Hi. Yes it is possible and you should test your routing configuration. You Can do it using MvcContrib. They implemented several extension methods on String class that make route testing a piece of cake. Example:
[SetUp]
public void SetUp() {
RouteTable.Routes.Clear();
MyApplication.RegisterRoutes(RouteTable.Routes);
}
[Test]
public void Routing() {
"~/".ShouldMapTo<HomeController>(cont => cont.Index());
"~/home".ShouldMapTo<HomeController>(cont => cont.Home());
"~/solutions".ShouldMapTo<HomeController>(cont => cont.Solutions());
"~/licences".ShouldMapTo<HomeController>(cont => cont.Licences());
"~/company".ShouldMapTo<HomeController>(cont => cont.Company());
"~/support".ShouldMapTo<HelpController>(cont => cont.Support());
"~/privacy".ShouldMapTo<HelpController>(cont => cont.Privacy());
"~/account".ShouldMapTo<AccountController>(cont => cont.Index());
"~/account/logon".ShouldMapTo<AccountController>(cont => cont.LogOn());
}
Voice
2010-06-06 05:12:06