Web api basic authentication

Discussion in 'ASP.NET / ASP.NET Core' started by ThornOne, Sep 7, 2013.

  1. Hi,

    Looking for some help please. I have an android application that is using httpclient to call my web api that is hosted on discountasp.net.

    This is working fine and I'm able to read the returned JSON and display in my application.

    I have setup one API to use basic authentication so that username:password is sent in the header. I haven't configured SSL yet on discountasp.net as I want to test it first. I have tested this locally by deploying the api to localhost and it worked fine.

    I am getting a 401 unauthorized response when I am calling the live api. I have tested this is fiddler and I am also getting a 401 response.

    Any ideas of what could be causing this 401? Would it be a setting on IIS 8 on discountasp.net?

    Regards,
     
  2. Got this sorted. Had to disable basic authentication on IIS

    <system.webServer>
    <security>
    <authentication>
    <basicAuthenticationenabled="false" />
    </authentication>
    </security>
    </system.webserver>
     
    Garrie Daden likes this.
  3. martino

    martino DiscountASP.NET Staff

    Thank you for posting what worked for you and you solved your issue. I'm sure it will help someone else in the future.
     
  4. Thank you, this was my issue as well!
     

Share This Page