Wednesday, July 07, 2004

Retrieving the identity associated with the current Thread

Using the System.Threading and System.Security.Principal namespaces, you can obtain the identity of the user associated with the current thread:


IPrincipal wp = Thread.CurrentPrincipal;
IIdentity id = wp.Identity;

string authType = id.AuthenticationType;
string isAuth = id.IsAuthenticated.ToString();
string name = id.Name;

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?