简体   繁体   中英

ASP.NET MVC 4, Windows Authentication and Active Directory

I have two machines:

  1. Windows 2008 - for Active Directory
  2. Windows 7 - installed with IIS7, it also serves as development machine. Note that this PC is not member of the domain.

I tried Forms Authentication and it's working fine with this configuration in my web.config:

<connectionStrings>
    <add name="ADConn" connectionString="LDAP://192.168.0.21" />
</connectionStrings>

<membership defaultProvider="ADMembership">
  <providers>
    <add name="ADMembership"
         type="System.Web.Security.ActiveDirectoryMembershipProvider"
         connectionStringName="ADConn"
         connectionUsername="dominic"
         attributeMapUsername="sAMAccountName"
         connectionPassword="p@ssw0rd" />
  </providers>
</membership>

Now I want to change from Form to Windows Authentication. My questions are:

  1. What configurations do I need to add in Web.Config to enable Windows Authentication?
  2. What configurations should be done in IIS to enable Windows Authentication?
  3. Do I need to configure Windows Firewall?
  4. When logging in using Windows Authentication, what should be my username? Is it "192.168.0.21\\dominic" or "dominic"?
  5. Did I miss to ask any question?

I tried many tutorials today but it's either giving me 403 or it's not accepting my username and password. If you know any complete step-by-step tutorial, please let me know.

After days of research, it turns out that IIS at least, should be a member of the domain. The client does not necessarily be a member of the domain.

In the Web.Config, all I need to add is:

<authentication mode="Windows" />
<authorization>
  <allow users="*"/>
  <deny users="?" />
</authorization>

Connection string and membership are not necessary.

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