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
15 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
776 Points
158 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
15 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
623 Points
203 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
17953 Points
3635 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
26 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
42884 Points
7019 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
8140 Points
837 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