jQuery ajax calls not working with ASP.Net Web Forms when FriendlyUrls are added

后端 未结 3 1943
孤街浪徒
孤街浪徒 2021-01-05 13:49

The following code works just fine without FriendlyUrls turned on for an ASP.Net Web Forms project:



        
3条回答
  •  一整个雨季
    2021-01-05 14:14

    So, ultimately I got the solution to my question by making following changes to my project:

    1. Add FriednlyUrls to the project.

    2. Remove the line in RegisterRoutes method that sets settings.AutoRedirectMode property in App_Start/RouteConfig.cs

      (note that setting it to RedirectMode.Permanent or RedirectMode.Off did NOT work for me)

    3. Add authorization in web.config as follows under system.web section

      
          
      
      
    4. Modify the url in ajax call set up to use Microsoft.AspNet.FriendlyUrls.Resolve function in order to get the correct url as below:

      
      

提交回复
热议问题