简体   繁体   中英

Windows Server 2008, IIS7 and Windows Authentication

We currently have a development server set up which we are trying to test some Windows authentication ASP.NET code on.

We have turned on Windows Authentication in IIS7 on Windows Server 2008 R2 fine, and it asks the user for a username and password as excepted, but the problem is it doesn't appear to accept any credentials. This code for example...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.Title = "Home page for " + User.Identity.Name
End Sub

...always returns an empty string.

One theory we have is that we dont have Active Directory installed as of yet, we are just testing this by logging on via the machine name not a domain.

Is this type of authentication only applicatable to domains (if so we can probably install Active Directory and some test accounts) - or is it possible to get the user identity when logging in using the machine name?

Ideally we would like to be able to test this on our local machines (Windows 7 Pro) using our own accounts (again these aren't on a domain) and IIS but this has the same issue as our dev server.

** Note I have asked this on serverfault as well, but I think this question crosses both the server and programming line. **

Thanks,

Finally figured it out by playing around. If any one is interested here is what I did...

On Windows Server 2008 I opened up the 'Edit Local Users and Groups' policy. I added a new user for the client. Then in IIS I set the authentication to Windows Authentication only, then I opened the 'IIS Manager Permissions' and added the new user and my self.

Not quite sure if this is the exact way to go about it but it seems to work for us.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM