Introduction:
Here i will explain Remove ASPX Extension in Web Application.
Description:
the most of asp.net web-site in when page load that time show the page extension, but here i can provide the code then your web application not show page extension.
Put following lines of code into your global.ascx file:
void Application_BeginRequest(object sender, EventArgs e)
{
String fullOrigionalpath = Request.Url.ToString();
String[] sElements = fullOrigionalpath.Split('/');
String[] sFilePath = sElements[sElements.Length - 1].Split('.');
if (!fullOrigionalpath.Contains(".aspx") && sFilePath.Length == 1)
{
if (!string.IsNullOrEmpty(sFilePath[0].Trim()))
Context.RewritePath(sFilePath[0] + ".aspx");
}
}
0 comments :
Post a Comment