URL Rewriting In ASP.NET 4.0/ 4.5 WebForm
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*"
path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<remove name="UrlRoutingHandler"/>
</handlers>
</system.webServer>
routes.MapPageRoute("CsharpCode", "CsharpCode-abhishek-list", "~/csharpcode.aspx");
//Route Name : CsharpCode
//Route URL : CsharpCode-abhishek-list
//Physical File: ~/csharpcode.aspx
Code of Global.asax file
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
}
static void RegisterRoutes(RouteCollection routes)
routes.MapPageRoute("myfriend1", "csharpcorner-friend-list", "~/FriendList.aspx");
//Route Name : myfriend1
//Route URL : csharpcorner-friend-list
//Physical File: FriendList.aspx
void Application_End(object sender, EventArgs e)
// Code that runs on application shutdown
void Application_Error(object sender, EventArgs e)
// Code that runs when an unhandled error occurs
void Session_Start(object sender, EventArgs e)
// Code that runs when a new session is started
void Session_End(object sender, EventArgs e)
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
</script>