Alper
Alper

Reputation: 1403

ASP.NET Webforms 4.0 Routing : How to get rid of physical urls

How would you accomplish these in ASP.NET Webforms 4.0 Routing;

Thanks.

Upvotes: 7

Views: 909

Answers (2)

Brian Mains
Brian Mains

Reputation: 50728

You can specify ignore routes to ignore routing for your static handlers, for the static content part (though routing, if the static file exists, normally gets routed directly to the file no problem).

I believe the method you want to use though is MapPageRoute for web forms, which is for web forms. See this for examples: http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.mappageroute%28VS.100%29.aspx

Upvotes: 1

David Fox
David Fox

Reputation: 10753

Have you read Scott Guthrie's post introducing this subject?

http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

You would do the following:

void RegisterRoutes(RouteCollection routes)
{
    routes.MapRoute("nameofroute", "home/", "~/Default.aspx");
}

Adding parameters as necessary

Upvotes: 0

Related Questions