Header add

 In this article we will learn how to resolve, ASP.NET Calling WebMethod with jQuery AJAX 401 (Unauthorized).

On the recent practice I have faced a issue while calling the Web Service method in ASP.Net.

{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}


How to resolve this

To resolve this issue simply go to the RouteConfig.cs file under App_Start folder.



Change the below lines 
settings.AutoRedirectMode = RedirectMode.Permanent;
To
settings.AutoRedirectMode = RedirectMode.Off;


And after this change my code is worked perfectly like below,


Summary
In this tutorial we discussed how to resolve ASP.NET Calling WebMethod with jQuery AJAX 401 (Unauthorized). If have any question related to this topic then give your feedback.

Post a Comment

Previous Post Next Post