1

I'm new to ASP.NET MVC and trying to determine the best approach for the following task. I have the following URLs that carry over from Web Forms application, that I want to continue to function by returning following paths in MVC:

  1. http://example.com/Default.aspx -> http://example.com/
  2. http://example.com/about.aspx -> http://example.com/about
  3. http://example.com/keyword1-keyword2-contact.aspx -> http://example.com/contact

Should I create a new Map Route or use URL Rewrite module? Please provide an example for the approach you advocate. The application is hosted in IIS 7.5 and uses ASP.NET 4.5 and MVC 4.0.

1

1 Answer 1

1

I'm new too, but I will try to help you.

In App_Start/RouteConfig.cs

1

routes.MapRoute(
   null,
   "Default.aspx",
   defaults: new { controller = "Default", action = "Index"},
);

2

routes.MapRoute(
   null,
   "about.aspx",
   defaults: new { controller = "Default", action = "About"},
);

3

routes.MapRoute(
   null,
   "{keyword1}-{keyword2}-contact.aspx",
   defaults: new { controller = "Default", action = "Contact"},
);
Sign up to request clarification or add additional context in comments.

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.