Hi i am using "System.Security.Principal.WindowsIdentity.GetCurrent().Name " to get the client machine username,with windows authentication in my web.config. My question is that whether this code works when i put the page in intranet.Did i able to get the user name who ever logged in my page by using this...b'coz i need to create a session of the username and proceeds further.
This the Code I am using
void Authenticate() { string strLogin = null;
try
{
strLogin = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Session.Add("Login", strLogin);
//Label1.Text = strLogin;
//Label2.Text = System.Environment.UserName;
}
catch (Exception ex)
{
Response.Write(strLogin);
Response.Write("<br/>handled:" + ex.Message.ToString());
Response.End();
}
finally
{
GC.Collect();
}
}