Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > determine ASP.NET worker process user context programatically?

Reply
Thread Tools

determine ASP.NET worker process user context programatically?

 
 
=?Utf-8?B?RGFubnkgTWlsbGVy?=
Guest
Posts: n/a
 
      09-30-2005
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

 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      09-30-2005
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.GetCurre nt().Name

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



"Danny Miller" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFubnkgTWlsbGVy?=
Guest
Posts: n/a
 
      10-01-2005

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.





"Karl Seguin" wrote:

> 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.GetCurre nt().Name
>
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
> http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
>
>
>
> "Danny Miller" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >

>
>
>

 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      10-03-2005
I honnestly don't know in that case. You could read the machine.config's
processModel section to read how asp.net is configured to run by default,
and go at it from there.

This link might, though probably not, be useful:
http://msdn.microsoft.com/library/de...delegation.asp

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



"Danny Miller" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.
>
>
>
>
>
> "Karl Seguin" wrote:
>
>> 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.GetCurre nt().Name
>>
>> Karl
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>> http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
>>
>>
>>
>> "Danny Miller" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using application context with multi worker process setting. nicerun ASP .Net 1 11-18-2008 05:25 AM
How to get process id of hosting ASP.NET worker process ? Navin Mishra ASP .Net Web Services 0 02-07-2006 08:40 PM
I can map all files (.*) to asp.net worker.How do I map NO FILE to asp.net worker? alex ASP .Net 1 02-04-2005 03:18 AM
Use of Proactive Process Recycling for worker process Henry Chen ASP .Net 0 06-10-2004 05:56 AM
ASP.NET worker process context and SQL authentication Dave Mehrtens ASP .Net 4 08-19-2003 08:40 PM



Advertisments