MVC Routing: Using Static URL Segments

Not all of the segments in a URL pattern have to be variables – we can also create patterns
which have static segments. If we want to match a URL like this: http://mydomain.com/Public/Home/Index where we want to support URLs that are prefixed with Public, we can do so using a pattern like the following one:

routes.MapRoute(“”, “Public/{controller}/{action}”,
       new { controller = “Home”, action = “Index” });

About Arefin

Tech Lover !
This entry was posted in ASP.NET MVC. Bookmark the permalink.

Leave a comment