I have a WebApi project , which returns some data , this works fine when we query through the URL , but returns 401 when i invoke it from my console app. this project has been hosted in IIS 8 and i need this to run under windows authentication. If i set it to anonymous authentication then works fine, but gives error to windows auth mode. Thanks in advance.
2 Answers
Check HTTP Status Codes RFC ...401 stands for Unauthorized Access means while invoking from your console app you are not passing the Authorization header in your API request.
Comments
Check this out(it has info on using windows authentication with web API):
https://www.codeproject.com/tips/996401/authenticate-webapis-with-basic-and-windows-authen
<authentication mode="Windows" />undersystem.webof your application'sapp.configworks fine when we query through the URL , but returns 401 when i invoke it from my console app- is your credentials saved in the browser? try running it under incognito mode and check for the status code.