Wednesday, November 21, 2012

.NET Get user name

Here are the different ways to obtain user name in .NET:

-- To obtain from windows logon
Environment.UserName


-- To obtain from Siteminder
Request.ServerVariables["HTTP_SMUSER"]

-- To obtain from authentication
Request.ServerVariables["AUTH_USER"]

-- To obtain from application
HttpContext.Current.User.Identity.Name
Page.User.Identity.Value

If you have other ways, pls add in here.


No comments: