I'm trying to use System.Threading.Thread.CurrentPrincipal.Identity.Name
to get the login of who is using an ASP.NET application. I'm not getting any build errors, but it returns a blank value. I'm using IIS 6 and here are my authentication settings:
- Anonymous Authentication: Disabled
- ASP.NET Impersonation: Disabled
- Basic Authentication: Enabled
- Windows Authentication: Enabled
I have no authorization settings in my Web.config
file either. Here is the method I am using to try to get the login:
public void SetUser()
{
string login = System.Threading.Thread.CurrentPrincipal.Identity.Name;
}
I have a breakpoint to check the value and it says login = ""
.
How can I get the login?
EDIT
Here is my authentication picture:
HttpContext.Current.User.Identity.Name
instead. – Piecedyed