Sankar M
Sankar M

Reputation: 4779

Remove HttpPage Extension in asp.net web application

I want to remove Http Page Extension 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.

Upvotes: 0

Views: 392

Answers (2)

Adam Tuliper
Adam Tuliper

Reputation: 30152

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");
    }

Upvotes: 1

mironych
mironych

Reputation: 2978

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

Upvotes: 0

Related Questions