?
Solved

Retrieve System User Name In ASP.Net

Posted on 2004-10-18
6
Medium Priority
?
1,287 Views
Last Modified: 2008-01-09
I have an application where the "Creator:" field needs to be populated from a dropdown list of names. I need to retrieve the UserName from the system, but it comes back as is ASPNET. Is there a way I can get the page to retrieve the login name used to logon on to the computer.
Thanks
0
Comment
Question by:name43
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 375 total points
ID: 12337698
Make sure you have done following things:

  - Disable Annonymous Access (from IIS)
  - Turn on Windows Authentication (in Web.Config)  (<authentication mode="Windows" />)
  - Use 'User.Identity.Name' or Request.ServerVariables("LOGON_USER") or Request.ServerVariables("REMOTE_USER") to retrive Username

-tushar

0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12337705
Hi name43,

first of all you have remove anonimous access to the virtual directory
second, the user name can be got like HttpContext.Current.User.Name

Regards!
B..M
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12337708
tusharashah,

sorry, there was nothing when i've started to write

B..M
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:CJ_S
ID: 12337709
There is a differenence between the username on the computer and the username used to log on to the system. When you are on an intranet you can use Windows Integrated Logon. This means that, with correct settings on the client, that the current logon information is used to log on to the website. When Anonymous access is disabled the website will require you to log on with a username and password combination that is recognized on the domainname (also specified on the server).

With anonymous access enabled there is a big chance that you will not get the current username from the client. You can try to read out the servervariables properties LOGON_USER or AUTH_USER, but those will return you the ASPNET user (like you have right now).
Without adjusting the client and serverside settings to enable windows authentication the only thing you can do is add an ActiveX control which is loaded on the client to read the current username and insert that into a hidden field.

Did this information solve your question?
0
 
LVL 1

Author Comment

by:name43
ID: 12337919
Thanks for your help, I saw this answer on many pages but could not set it up correctly, But I have done that now and can retrieve the user name used to logon on to the PC.

Thanks
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12337966
Nice to have you going name43!

B..M, I understand that happens... but that was very nice of you :)

-tushar
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 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