I want to remove ".aspx" from my web appliaction url. also I have using webservices.
If I use below code web services is not working.
Global.asax
protected void Application_BeginRequest(object sender, EventArgs e)
{
String WebsiteURL = Request.Url.ToString();
String[] SplitedURL = WebsiteURL.Split('/');
String[] Temp = SplitedURL[SplitedURL.Length - 1].Split('.');
// This is for aspx page
if (!WebsiteURL.Contains(".aspx") && Temp.Length == 1)
{
if (!string.IsNullOrEmpty(Temp[0].Trim()))
Context.RewritePath(Temp[0] + ".aspx");
}
}
for Eg:-
Actual page is DEFAULT.aspx, but I want to show DEFAULT in address bar. So I used Global.asax to remove (.aspx). It's working fine. but Web service is not working(Default.asmx)
URLRewritemodule for IIS. Not necessarily the easiest to use, but very powerful and will do what I believe you want