views:

20

answers:

1

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.

+1  A: 

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.

womp