I've hosted asp.net MVC 4 + WebAPI in IIS 7.5 with windows authentication. When I call the WebAPI from MVC4 view, it gives me 401 unauthorized error. But it works perfectly fine from my localhost.
I've set the principal in both the places (Thread.CurrentPrincipal & HttpContext.Current.User) from my AuthenticationModule class.
I tried with System.Web.HTTP AuthorizeAttribute.
When I debug with Jquery console, i could see the context principal is null.
Let me know the following.
- IIS hosting configuration?
- How to design the WebAPI authenticate/authorize calls from views?