Capture the identity of the windows user accesing a web page

Posted on 2010-04-05
Medium Priority
Last Modified: 2012-08-13
I have a web application which is running in IIS 6.0, under a dedicated AppPool, which has an identity XYZ.

I need to capture the windows user information of the user accesing the web page.
I have anonymous access under Directory security unchecked.
I have Integrated Windows authentication checked.

I have the following code to capture the user information

lblUser.Text = User.Identity.Name;

But it returns the identity of the AppPool , which is XYZ.
How do I capture the identity of the windows user accessing the web page

In my web.config
I have
<authentication mode="Windows"/>
<identity impersonate="false"/>
Question by:countrymeister

Expert Comment

ID: 29841380
I have tried the same in my machine using the following code
lblUser.Text = Page.User.Identity.Name;
lblThread.Text = System.Threading.Thread.CurrentPrincipal.Identity.Name;
Both are giving me correct user Identity. Try implement both in you code.
LVL 20

Accepted Solution

brwwiggins earned 2000 total points
ID: 29916998

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question