Here I will explain URL rewriting using global.asax file. URL is useful for hide query strings from URL, change the page name or URL.
Add one aspx page in your project and give name Login.aspx.
Then after add this namespace on your global.asax file,
using System.Web.Routing;
Add this code in your global.asax file.
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routecollection) {
routecollection.MapPageRoute("Login", "Login", "~/Login.aspx");
}
Run the Login.aspx page without page extension as "Login".
For ex:
http://localhost:51965/Login.aspx //before URL rewriting
http://localhost:51965/Login //after URL rewriting
Comments
Post a Comment