0

I have a full web form application and want to migrate to MVC, before starting that I have been trying to implement The club site http://www.asp.net/downloads/starter-kits/extended-club using the instruction of Rob Conery, Scott Hanselman, Phil Haack in the book of Professional ASP.net MVC 2 in Chapter 12 . http://media.wiley.com/assets/1539/15/professionalaspnet35mvc_chapter13.pdf

I've created a folder for web form site, modified the Site.Master in shared folder using the web form master-page code and the result looks like: the club site image

According to the instructions I have to add routing to the site in Global.asax where I have tried many mapping route functions like:

  routes.MapRoute(
           "news", // Route name
           "{controller}/{action}/{id}", // URL with parameters
           new { controller = "News", action = "Index", id = UrlParameter.Optional } // Parameter defaults
       );


        routes.MapPageRoute(
  "mvchome",
  "home/index/{id}",
  "~/ClubSite/News_List.aspx"
  );

But no changes. Have I missed something in before jumping to routes (Global.asax) or the solution is in giving the proper route or proper routes to all web forms pages?

1 Answer 1

4

The first route matches ANY route, it is essentially a wildcard route. Place your other route BEFORE that route and it will be recognised.

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

2 Comments

You mean I place this code: routes.MapPageRoute( "mvchome", "home/index/{id}", "~/ClubSite/News_List.aspx" ); BEFORE.
@Akbar Admg, yes. Therefore when routes are resolved, it will hit your route before the catch-all route.

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.