determine ASP.NET worker process user context programatically?

G

Guest

Hi there,

I've got a web app that uses impersonation and makes calls to a SQL Server
backend. I'd like to be able to automate the setting of database security for
the web app upon deployment. What I'd like to do during installation is the
following:

- run the database creation script
- determine the user context that the ASP.NET worker process is running under
- assign privileges for that user in the new database

Can anyone tell me if it is possible to programmatically determine the user
context that the ASP.NET worker process is running under and if so, how?

Under IIS5 this would be a case of interrogating the <ProcessModel> node in
Machine.config would it not? However, I'm not so sure if this is
deterministic and also, the same method won't work for machines running IIS6.

Thank you,

Danny
 
K

Karl Seguin

Well, you can get a lot of information from System.Diagnostic.Process, but I
don't think you can get what you want...

I believe this will work for you though:
System.Security.Principal.WindowsIdentity.GetCurrent().Name

Karl
 
G

Guest

I might have to elaborate a little more. I will be attempting to obtain the
ASP.NET worker process id from within an msi custom action, not from within a
web app. The call you provided would do what's required from within a web
app but would provide no information about the ASP.NET worker process from
within an msi custom action.
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top