Token of user identity

P

ptran123

In IIS, when 'anonymous user' is disabled anyone entering the site must
be authenticated. After authentication, IIS's worker process assumes
the identity of the authenticated user rather than the identity of the
worker process. So far I've only found code that obtains the token of
the worker process' identity. That's not what I need. Is there a way
to obtain the token for the user? Thanks in advance.
 
E

Elton Wang

Hi,

Since you deny anonymous access, you can get authenticated
user by

User.Identity.Name

It gives you DomainName\userID.

HTH

Elton Wang
(e-mail address removed)
 
S

Scott Allen

Hi ptran:

Do you have <authentication mode='Windows'/> and <deny users='?'/>
in your web.config? You should be able to cast Page.User.Identity to a
WindowsIdentity, which represents a token.

--s
 
P

ptran123

Actually, what I really need is the TokenPtr of the authenticated
user. That way I can get the SID of that user, and store it in the DB.
I only know how to get the tokenPtr of the process identity by the
code below.

WindowsIdentity wi = WindowsIdentity.GetCurrent();
IntPtr token = wi.Token;

the variable 'token' holds a pointer to the process identity. However I
need the tokenPtr of the authenticated user. ASP.NET doesn't seem to
have this capability.
 

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,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top