<%@ 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) { } void Application_Error(object sender, EventArgs e) { } void Session_Start(object sender, EventArgs e) { } void Session_End(object sender, EventArgs e) { } </script>
|