Avoiding the Controller with Routing Rules in ASP.NET MVC
Posted
by Ryan Elkins
on Stack Overflow
See other posts from Stack Overflow
or by Ryan Elkins
Published on 2010-03-23T00:33:02Z
Indexed on
2010/03/23
0:41 UTC
Read the original article
Hit count: 481
I've created a website with ASP.NET MVC. I have a number of static pages that I am currently serving through a single controller called Home. This creates some rather ugly URLs.
example.com/Home/About
example.com/Home/ContactUs
example.com/Home/Features
You get the idea. I'd rather not have to create a controller for each one of these as the actions simply call the View with no model being passed in.
Is there a way to write a routing rule that will remove the controller from the URL? I'd like it to look like:
example.com/About
example.com/ContactUs
example.com/Features
If not, how is this situation normally handled? I imagine I'm not the first person to run in to this.
© Stack Overflow or respective owner