Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retreiving windows login id in ASP.net

Status
Not open for further replies.

rushdib

Programmer
Jun 12, 2001
203
0
0
US
We are using ASP.net 1.1 on iis 6 and windows 2003 and trying to obtain the windows login id. It works fine in the development machine but when it's deployed on the server, it always gives the login id used to sign-on the server. It doesn't give the user's login id. We used the following to get the login info:

HttpContext.Current.User.Identity.Name
User.Identity.Name
Page.User.Identity.Name()
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Environment.UserName

Please help

Thanks,
 
what are your web.config settings? you need to implmement Windows authentication with impersonation = true

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
We tried that.

<authentication mode="Windows" />
<identity impersonate="true"/>

Still no luck
 
is IIS virtual directory configured to use Windows Authentication? is anonymous login disabled

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Yes, I have checked only the integrated windows check box.
 
i'm at a loss. these are the 2 biggest issues.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Jason,
I know. We are confused as well. It looks like the page is getting authenticated by the server login instead of the user who open the page. If I check the anonymous in iis, then it returns a null, so the integrated security is working but it's using the server login.
Now if use the basic authentication, then it's returning the correct login.
Is there any other setting iis 6 or windows 2003, that's doint this?
 
the server is part of the network correct? any app i've written is for the intranet, so the server is part of the domain which users log onto.

do you have control over the server/machine.config? or is there a sperate administrator/department which is responsible for that? I would check the overall IIS and machine.config settings to make sure nothing is locked.

web.config overrides/appends to machine.config so if the defaults are set this isn't the problem.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
This is intranet. I have control on the server. Which part should I check on iis or machine.config?
 
One reson could be that we are using AD.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top