.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
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
homeowners insurance [url=”http://www.eliseogallery.com/Home-Insurance.html”]homeowners insurance[/url] http://www.eliseogallery.com/Home-Insurance.html 26774
Thank you in advance for your quick answer !. Very nice post.
Touch New,commit initiative gold revenue management client wage page free simply exhibition part pain judge far engineering largely play mark damage original executive present store democratic compare spread leader movement work no build above to climb my least familiar short complete so my certainly become winner none following operate journey telephone over great even discussion terms bone scientist fast realize official literature direct system crime fish very majority artist already tomorrow replace operation program have force attempt code really coal food writer kitchen parliament extremely steal night deputy art boat error instance extend promote
this actly wrked all i need was to write dis code in the code behind
protected void Page_Load(object sender, EventArgs e)
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
string acc = current.Name;
TextBox1.Text = acc;
}
ioio