473,662 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Token of user identity

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.

Nov 19 '05 #1
3 1698
Hi,

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

User.Identity.N ame

It gives you DomainName\user ID.

HTH

Elton Wang
el********@hotm ail.com

-----Original Message-----
In IIS, when 'anonymous user' is disabled anyone entering the site mustbe authenticated. After authentication, IIS's worker process assumesthe identity of the authenticated user rather than the identity of theworker process. So far I've only found code that obtains the token ofthe worker process' identity. That's not what I need. Is there a wayto obtain the token for the user? Thanks in advance.

.

Nov 19 '05 #2
Hi ptran:

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

--s

On 13 Apr 2005 12:02:06 -0700, pt******@hotmai l.com wrote:
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.


--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #3
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.

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6070
by: Maya | last post by:
Hello, I have three questions, and any answer might help :) 1. I have the following situation: I have application that is launched from the SYSTEM User, so it runs under this user too. That of course is a high security risk in many aspects. I know how to Create a process "AsUser", but I have to know the Username and Password for a user to do so. Is there a way (= does anyone know a way) to get the User Token for the User that is logged...
2
3042
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some content based on the user's role. I wrote this to do it: if (HttpContext.Current.User.Identity.IsAuthenticated) { plLoggedIn.Visible = true;
4
17785
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: Web.HttpContext.Current.User.Identity.Name to write audit trail as to what users do. Now recently on one of the activities I noticed that the
8
9449
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
15
2914
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the login id in other forms of the app. I will eventually save a record to a SQL database, and I want the login id to be automatically entered in a field on a form other than the login page. Help.
3
1768
by: Patrick Olurotimi Ige | last post by:
How can i send LOGON_USER or User.Identity.Name to the Database? I'm working on a survey which is intranet based with Windows Authentication. I can get the current user by calling LOGON_USER or User.Identity.Name ! But i want to pass(the current user) to a table in DB! I was thinking of ussing hidden textboxes like so :- Is it a good approach.. Any ideas appreciated!
0
2739
by: jakobsgaard | last post by:
It is possible to Map a certificate to a Active Directory User Account from DotNet? Please provide an example. Best regards, Ejnar Jakobsgaard ------------------------------------------------- To map a certificate to a user account Open Active Directory Users and Computers.
26
4405
by: ryampolsky | last post by:
I'm using strtok to break apart a colon-delimited string. It basically works, but it looks like strtok skips over empty sections. In other words, if the string has 2 colons in a row, it doesn't treat that as a null token, it just treats the 2 colons as a single delimiter. Is that the intended behavior?
3
8947
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
hi folks, I've got XP pro service pack 2 VS 2005 TSE with ASP.net 2.0 and C# I'm doing an example from Stephen Walther's so far excellent book and he has a whole load of stuff to add the current user to a role like so: <script runat="server"> void Page_Load()
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.