Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I want to trim .aspx from my web application.... also I have using webservices...

If I use below code web services is not working...

Global.asax
C#
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");
          }
      }


What I have tried:

If I remove global.asax then webservice is working. But I want to trim .aspx and WebService might be work... how can I achieve that please help me... Thank You in advance...
Posted
Updated 19-Jun-16 22:52pm
Comments
Mehdi Gholam 20-Jun-16 2:26am    
What are you trying to do?
Udhay Titus 20-Jun-16 2:33am    
I tried url rewrite method in web.config but till webservice is not working
Madhu Nair 27-Jun-16 9:06am    
Search for "URL rewriting in ASP.Net". You will get lot of examples.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900