Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,
i am using url rewriting in my application.i want when user enter url in browser
i.e. htttp://www.abc.com or www.abc.com it will display the url i.e htttp://www.abc.com or www.abc.com respectively. but in my application it display the url i.e www.abc.com/user/index.aspx . it display the actual path in url.please help me to solvemy problem. below is my code in global.asax page

C#
void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RegisterRoutes(RouteTable.Routes);
        }

C#
public static void RegisterRoutes(RouteCollection routeCollection)
     {



         routeCollection.MapPageRoute("RouteForMainCategory", "{Category}", "~/User/index.aspx");
         routeCollection.MapPageRoute("RouteForSubCategory", "{Category}/{SubCategory}", "~/User/index.aspx");
         routeCollection.MapPageRoute("RouteForMainPage", "{ }", "~/User/index.aspx");


     }
Posted
Comments
[no name] 21-Nov-14 15:36pm    
Did you set this up in IIS first? Then configure the rewrite rules accordingly.

1 solution

do like this...it works.
routeCollection.MapPageRoute("RouteForIndex", "Default", "~/Default.aspx");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900