Create ASP.NET MVC type route URLs in Web Form application
URL Rewriting
URL Rewriting is done in the Application_Start method of Global.asax file. Where you need to define your all routes.
My Login & Contact us routes are
localhost:6782/Login.aspx
localhost:6782/Contactus.aspx
I want to change my routes so I need to register routes in Global.asax
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RegisterRoutes(RouteTable.Routes); } public static void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute("login", "login", "~/Login.aspx"); routes.MapPageRoute("contactus", "contactus", "~/Contact.aspx"); }
localhost:6782/login
localhost:6782/contactus
0 comments :
Post a Comment