3
votes

I am developing web application using angularJS and web api. I have hosted two separate projects on IIS. The URL for AngularJS is 'http://10.36.217.16:8081/index.html' and for web api is 'http://10.36.217.16/api/test'. I have enabled the windows authentication for both the sites and disabled the anonymous authentication on IIS. I have also passing 'withCredentials: true' on ajax request. I have set the authorization filter on my controller. I have also enabled the CORS in api and set SupportsCredentials is true.

My problem is the login prompt is fired twice, one for angular app and second for web api. How to pass the credentials after the first login prompt? Is there any setting which I have missed out.

I tried almost everything, please help! :)

1
Instead of an IP address try using the hostname without any dots: http://myhostname:8081/index.html which should send the AJAX request to http://myhostname/api/outage. - Darin Dimitrov

1 Answers

0
votes

No need to use Windows Authentication for both of two sites(Angular and web APIs). Set anonymous authentication enable in Angular app and enable Windows authentication in Web API site only. It will help to work fine your system with single login prompt.