Mara Mara - 10 months ago 57
ASP.NET (C#) Question windows authentication against domain - use local (cached) credentials when offline

I have ASP.NET MVC application that uses windows authentication against remote active directory server. The computer where the app runs is connected via VPN to the AD server. The problem is that after user logs into the PC with domain user and logs into the application it needs to run even while offline as well, but it throws this error:

The trust relationship between workstation and domain failed.

From what I understood there is no cookie and the authorization works on per-request basis. Is there any way to authorize the user name/password against the locally cached credentials? The connection often drops and the application needs to keep running.

Also I can't turn on Anonymous Authentication as we want to sign in users without providing credentials.

Any suggestions appreciated.

Thank you

Answer Source

It was due to calling (while off the network)


We have custom role management, so removing base.IsInRole on our custom WindowsPrincipal solved this issue.

After doing research I thought that it actually has to be on the network, but to keep using cached credentials you don't have to be, just do not try to fetch any user related information.