Get the account that ASP.NET runs under

  • Thread starter Mircea Pleteriu
  • Start date
M

Mircea Pleteriu

Hi all,

How to programatically obtain the account that ASP.NET runs under regardless
of what the OS is.

Thank you,
Mircea
 
M

Mircea Pleteriu

Thanks... but to be more clear...

I have a .NET console application which must determine the user account
under which the IIS runs the asp.net applications.
Under W2K it is the ASPNET, under W2K3 Server it is NETWORK SERVICE...
so.. I need a way to determine the account whatever the OS is.
 
J

Juan T. Llibre

A console app will always run as the logged-in Windows account.


Your problem is not finding out what the OS is.

ASP.NET can run as *any* account under any OS,
if ASP.NET has been setup to run using impersonation.

So, your first problem would be finding out
whether ASP.NET is using impersonation.

For that, if you're not running within an ASP.NET AppDomain,
you'd have to parse machine.config or the particular web.config.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top