I'm publishing a public ASP.NET website. I'm assuming the visitor开发者_如何学Python is using Windows and Internet Explorer. I want to display the Windows username on the front page, is it possible?
I have already enabled Windows Authentication in IIS and on a development environment everything works fine. On production it keeps asking the Windows login credentials.
For Windows Authentication, the user must supply credentials that can authenticate to the server/domain in which the website is running. If the client is running within the same domain and authenticated, Internet Explorer will automatically handle the credential exchange; this is why it works in the dev environment. However, when accessed from the public side, Internet Explorer tries to hand over the credentials that the user is currently using (some other Windows domain), but those credentials cannot authenticate to your sever, so IE prompts the user to enter credentials that can authenticate to that domain.
If it's a public website then you can't do it. Why? Because you would need to verify the user credentials against your AD and you can't do that on a public web page. (Which makes total sense, after all how would you know who I am otherwise?)
If you ARE doing this in an internal network where each account is in your Active Directory, then people just need to add the site to their Trusted Sites or Local Network Zone in IE for NTLM to work transparently.
精彩评论