Fidler HTTP / 1.1 401 Unauthorized

I have a local WEB.API project that does NOT run through local IIS to run a project that I am using F5 in Visual Studio 2013.

Using Fiddler I keep getting

HTTP/1.1 401 Unauthorized

#   Result  Protocol    Host    URL Body    Caching Content-Type    Process Comments    Custom  88  401 HTTP    localhost:52787 /api/values 6,180   private text/html; charset=utf-8    fiddler:10724           

      

I know that I should get 200, but I am not. Where should I check what I am doing wrong?

Here is a screenshot from the browser. I get this when I go back to Fiddler, to see the results, just type http://localhost:52787/api/helloapi

in the url (in the browser) and hit enter: enter image description here

And this is what I get when I go through the fiddler manually composing the GET:

enter image description here

I have the option "Automatically check authenticity".

+3


source to share


2 answers


When you say "using Fiddler", what exactly do you mean?



If you are manually composing a request using Fiddler Composer , either add the header Authorization

yourself or go to the Composer Options tab and check the box Automatically Authenticate

.

+7


source


I had the same problem. In my case, it was caused by a deny clause in the web.config file which forced all users to authenticate. This works well in the browser because it handles the authentication behind the scenes and sends the appropriate Cookie permission. In Fiddler, this handshake will fail and hence 401. In development environment add this to your web.config and it should work.



<system.web>
       <authorization> 
           <allow users="?" /> 
      </authorization>  
</system.web>

      

+1


source