Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 406985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:33:00+00:00 2026-05-12T17:33:00+00:00

I have a web-app that will reside on a production server where I want

  • 0

I have a web-app that will reside on a production server where I want to get the user’s logged in computer name, circa

DOMAINNAME/USERNAME

Many people have told me that I must use Impersonation/Delegation in order to get this, but no details beyond that have been provided. Originally, my tests used:

Response.Write("HttpContext: " & HttpContext.Current.User.Identity.Name & " \n")
Response.Write("Windows Identity: " & WindowsIdentity.GetCurrent.Name & " \n")
Response.Write("Thread: " & Thread.CurrentPrincipal.Identity.Name & " \n")
Response.Write(Request.ServerVariables("LOGON_USER"))
Response.Write(User.Identity.Name)

Which yields valid results on my local cassini server, but not when published. Adding the following line:

Dim ctx As WindowsImpersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero)

changes the WindowsIdentity to

SERVERNAME\ASPNET

However, I wish for the current user’s (not the server’s) username. How can I manipulate the impersonation class to give me this?

EDIT:
The solution provided, in the comments by Heinzi, seems to be correct. However, I believe this is IE6 only. The company I work for may be moving to IE8 in the near future and I wish to ensure functionality across IE 6/7/8 at the very least. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:33:00+00:00Added an answer on May 12, 2026 at 5:33 pm

    You need to

    • activate Windows Integrated Authentication in IIS,
    • turn off anonymous users either in IIS or in your web.config file (<authorization> section),
    • add <identity impersonate="true" /> in the <system.web> section of your web.config.

    EDIT: This question shows relevant parts from the web.config.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app that will draw a polyline for each user (tracks
We are developing a web app that will have a pretty complex user and
I want to create a simple web app that will have a connection from
Background I have a web app that will create an image from user input.
I have installed an HttpModule into my web app that will handle all requests
I'm about to have to write a web page/app that will serve the agenda
This is the scenario i have: im developing a web app that will list
I'm to make a web app that will implement something like user hierarchy. I
I have a web app that I want to use Backbone.js for. I have
I have a web app that populates user page history into the local storage.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.