Check under which account resources are accessed
Is there a way how I can check programmatically which user is used when my application accesses resources?
I have a production system which only our admin can access. Sometimes it is not clear what part of the system is wrong: Lets say when logging is not working. It is always possible that the web.config is wrong, but sometimes the directory is not accessible. It would make my life easier if I could be sure, that开发者_开发百科 the user is used, that I expected.
I am not talking about User.Identity.
You can return the underlying system account that you're running as:
Response.Write(Environment.UserName);
Unless you're using impersonation though, this should always be the ASP.Net process user.
精彩评论