3

is there any way to find out to which route my url is getting mapped in asp.net mvc.

2 Answers 2

3

You could try using Phil Haacks route tester.

Sign up to request clarification or add additional context in comments.

Comments

2

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());            
        }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.