I am creating a web site for internal use without login. I would like to be able to get the Windows username from the web users computer. does anyone know how to do this? Thanks in advance.
You can use Context.User.Identity.Name to get the login name, it would return name like Domain/Username. If you need to get the full name, department, etc, you need to connect to active directory. For this, you need to contact your IT team to get relevant
access.
CaptainAmeri...
None
0 Points
17 Posts
How to get the NT username of the web user
Jan 03, 2013 06:30 PM|LINK
Hello all,
I am creating a web site for internal use without login. I would like to be able to get the Windows username from the web users computer. does anyone know how to do this? Thanks in advance.
msmk
Participant
797 Points
180 Posts
Re: How to get the NT username of the web user
Jan 03, 2013 06:35 PM|LINK
Check this out. It should help you:
http://www.spiration.co.uk/post/1367/Get-Windows-username-of-current-user---C%23
CaptainAmeri...
None
0 Points
17 Posts
Re: How to get the NT username of the web user
Jan 03, 2013 06:50 PM|LINK
I tried this already., This will give me the username on the web server. I need the computer username of the web user.
Ramu Ajay
Member
631 Points
208 Posts
Re: How to get the NT username of the web user
Jan 03, 2013 07:00 PM|LINK
Context.User.Identity.Name
shahed.kazi
All-Star
17955 Points
3636 Posts
Re: How to get the NT username of the web user
Jan 03, 2013 11:42 PM|LINK
You can use Context.User.Identity.Name to get the login name, it would return name like Domain/Username. If you need to get the full name, department, etc, you need to connect to active directory. For this, you need to contact your IT team to get relevant access.
.NET World |Captcha Control
SandeepLakka...
Member
46 Points
27 Posts
Re: How to get the NT username of the web user
Jan 04, 2013 12:15 AM|LINK
try this ..
string Auth_User = HttpContext.Current.Request.ServerVariables["Auth_User"];
Auth_User = Auth_User.Substring(Auth_User.IndexOf("\\") + 1, Auth_User.Length - (Auth_User.IndexOf("\\") + 1));
Ruchira
All-Star
44216 Points
7184 Posts
MVP
Re: How to get the NT username of the web user
Jan 06, 2013 09:55 AM|LINK
Hello,
If you are not using windows authentication, you can't get the windows username in client machine. You need to use windows authentication for that.
Then you can get the user name as below
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Pengzhen Son...
Star
8638 Points
884 Posts
Microsoft
Re: How to get the NT username of the web user
Jan 10, 2013 10:31 AM|LINK
Hi,
I hope you may get your answer in this link: http://msdn.microsoft.com/en-us/library/ff647076.aspx .
And please refer to the issue: http://forums.asp.net/t/1598421.aspx/1 .
Hope it can help you.
Feedback to us
Develop and promote your apps in Windows Store