Retrieve web user's Identity outside of request scope

Posted by Kendrick on Stack Overflow See other posts from Stack Overflow or by Kendrick
Published on 2011-02-14T14:50:28Z Indexed on 2011/02/14 15:25 UTC
Read the original article Hit count: 193

I have an ASP.NET app that logs Audit reports using nHibernate's IPreUpdateListener. In order to set the current user in the Listener events, I was using System.Security.Principal.WindowsIdentity.GetCurrent(). This works fine when debugging on my machine, but when I move it to the staging server, I'm getting the ASP.NET process credentials, not the requesting user.

In the ASP.NET page, I can use Request.LogonUserIdentity (which works fine since I'm using integrated authentication), but how do I reference this user directly without having to pass it directly to my event? I don't want to have to pass this info through the pipeline because it really doesn't belong in the intermediate events/calls.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about iis