I have an ASP.NET 4 app that I have in a virtual directory in my SharePoint site. This is a self contained app in its own app pool so I don’t think SP is the problem but? The aspx page works fine, but a request to the ApiController returns 401 Error: Access is Deniend.
<html><head><title>Error</title></head><body>Error: Access is Denied.</body></html>
Event Viewer has nothing and IIS log shows 401 2 2148074254 then 401 1 0 then 200 0 0 then 401 1 2148074248. I Know that last 401.1 looks like my mistake, but I have confirmed many times it is the Last log entry for a request. Consistant in IE8, Chrome, FireFox.
Fiddler shows only 401s, “WWW-Authenticate: NTLM” alternating with “WWW-Authenticate: NTLM TlRMblah_blah_blah…” and the HTML above.
Backup plan is to ditch the controller and use a .ashx, but hopefully SO can help.
Found a work-around until the project is no longer in SharePoint. Kept the Controler class (PSSController) as-is, but added an ashx file with the below code and changed the javascript to use it. cntrl is just my class; your QueryString and Post params will be different. A bit hacky but it works 🙂
}