Remove HttpPage Extension in asp.net web application
I want to remove Http Page Extensio开发者_如何学编程n like this
my actual page: http://test.com/dashboard.aspx
i need to modify as follows http://test.com/
for all redirection of .aspx page.
P.s: i dont want to use URL rewriting.
Use asp.net 4's routing engine. You can specify a routing rule in asp.net 4 as a default route. Check out: http://www.xdevsoftware.com/blog/post/Default-Route-in-ASPNET-4-URL-Routing.aspx
for a very basic one that may work in your scenario try this in your global.asax.cs to map everything to say default.aspx
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Default", "{*whatever}", "~/default.aspx");
}
You can write HttpModule where you can scan incoming url and make all that you want before request will be processed.
http://msdn.microsoft.com/en-us/library/ms227673.aspx
精彩评论