Solved

Retrieve System User Name In ASP.Net

Posted on 2004-10-18
6
1,281 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 125 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
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…

717 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