.NET Tip - Getting logged in user name in ASP.NET web application

Frequently we desire to autopopulate some fields on our web form with the current logged in username and domain.

How to get that information?

Well, User.Identity.Name comes to the rescue.

Set the text property of the field to User.Identity.Name and it will show the logged-in username prefixed by the domain information

Published Tue, Feb 7 2006 14:30 by Vipul Patel

Comments

# re: .NET Tip - Getting logged in user name in ASP.NET web application

This is How you do it in the Windows - WinForms

Getting the User Credentials in Windows Forms

using System.Security.Principal;
.....

WindowsIdentity currIdentity = WindowsIdentity.GetCurrent();

string NtAccountName = currIdentity.Name;

Enjoy !

Amol

Tuesday, May 23, 2006 4:20 PM by Amol Wankhede

Leave a Comment

(required) 
(required) 
(optional)
(required)