I have a migration from aspx to MVC5, and when I'm not logged, if I write a wrong route, I get a 404 error, fine. But if I'm logged and I try that, I get this:
[UnauthorizedAccessException: Denied access. (Exception of HRESULT: 0x80070005 (E_ACCESSDENIED))]
It doesn't matter if its a wrong controller or action, just a wrong route. I have tried this post: Visual Studio 2017 HRESULT: 0x80070005 / E_ACCESSDENIED on project creation, but it didn't work. It's not a local issue, because it's happening in other computer (in localhost, of course).
EDIT
I have found that a exception is being throwed just when "Application_PreSendRequestHeaders" (both workflows reach this method equally) is going to return the webpage. When I'm not logged, all works fine and after that method I get 404 page. But when I'm logged, I don't know why, just after "Application_PreSendRequestHeaders", flow goes to "Application_BeginRequeset" again to prepare error request.
I have to say, too, this error is "handled" in a else clause in "Application_Error" and the if condition is:
Context != null && Context.IsCustomErrorEnabled
Being "IsCustomErrorEnabled" = false and having it setted in my Web.config to get custom errors.
EDIT 2
Well, doing some test, I realised that "HttpContext.Current.User.Identity.Name" changes when flows goes from "Application_PreSendRequestHeaders" to "Application_BeginRequeset". I don't know how nor why, but it takes my computer user name.
User contributions licensed under CC BY-SA 3.0