Question Cannot get logged in windows username hosted in IIS 7

JuniorR

New member
Joined
Sep 17, 2015
Messages
1
Programming Experience
1-3
Hi there...

I have an application hosted in IIS 7 which has basic authentication. I am successful in getting the logged in windows username when it is running locally but my application fails to display the windows username when hosted in IIS 7. It display SYSSAI-SQL. In IIS 7 I have the advanced settings for the Physical path credentials set to MyDomain\syssai-sql.

I have tried the following code below which some works locally but none when hosted:

Session["User"] = WindowsIdentity.GetCurrent().Name;
lblusername.Text = HTTPContext.Current.Session["User"].ToString();

- System.Environment.Username
- Request.ServerVariables["LOGON_USER"]
- System.Security.Principal.EindowsPrincipal user;
- Request.ServerVariables.Get("AUTH_USER");

Thanking you for your help in advance.


 
Top Bottom