<%@ Application Language="C#" %><script RunAt="server"> void Application_BeginRequest(object sender, EventArgs e) { string curruntpath = Request.Path.ToLower(); curruntpath = curruntpath.Trim(); bool isredirected = curruntpath.EndsWith(".aspx"); bool isredirected2 = curruntpath.EndsWith(".html"); bool isredirected3 = curruntpath.EndsWith(".jpg"); bool isredirected4 = curruntpath.EndsWith(".jpeg"); bool isredirected5 = curruntpath.EndsWith(".gif"); bool isredirected6 = curruntpath.EndsWith(".png"); // string atr = curruntpath.Substring(curruntpath.IndexOf("/")); if (!isredirected && !isredirected2 && !isredirected3 && !isredirected4 && !isredirected5 && !isredirected6) { HttpContext obj = HttpContext.Current; string finalurl = curruntpath + ".aspx"; if (System.IO.File.Exists(Server.MapPath(finalurl))) { obj.RewritePath(finalurl); } else { obj.RewritePath("Error.aspx"); } } if (curruntpath.EndsWith(".aspx")) { HttpContext obj = HttpContext.Current; obj.RewritePath("Tohideextentions.aspx"); } } void Application_Start(object sender, EventArgs e) { } 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>
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: