views:

1187

answers:

1

I hope this is not to paradoxal, but I don't know how this should be done...

I have a VS2008 ASP.NET MVC Project with the following Web.Config entry:

  <authentication mode="Windows">
      <forms name=".ADAuthCookie" timeout="10" />
  </authentication>

This makes the visitor logon automatically with their DOMAIN\username login which they used to logon to Windows. (Right?)

This works with my development server (http://localhost:xxxx), but not with my IIS server (http://localhost). Probably because the development server is 'started' by my local user (which has ActiveDirectory read-rights on the domain) and because IIS is 'started' by the IUSR_WORKSTATION user which does not. (Right?)

If all of the above is true, how can I impersonate the IIS user (for instance to my own username) to solely authenticate the current user with the Windows login name? (like the example below)?

Or should the IUSR_WORKSTATION user be granted ActiveDirectory? read-rights (not preferred as I will be switching servers / IUSR_ users a lot)

<identity impersonate="true" userName="DOMAIN\myuser" password="mypass"/>
<authentication mode="Windows">
    <forms name=".ADAuthCookie" timeout="10" />
</authentication>
<identity impersonate="false"/>
+2  A: 

Windows authentication is poorly named (IMO). It's not using Windows as the authentication, but rather it delegates the authentication process to IIS. So you need to configure IIS's authentication, which then flows down to ASP.NET

How you do this depends on your version of IIS, in IIS7 expand out the tree and click your web site, then click Authentication and enable Windows Authentication

blowdart
Ah that makes some things clearer. 1.) So I should disable anonymous access in IIS? 2.) Can I configure the built-in VS2008 webserver to do the same? (the security tab under ASP.NET Website administration tool gives the following error: The Active Directory membership provider has not been configured to support search methods.)
Ropstah
Yes you'll need to disable anonymous access if all you want is people in your AD to login.Cassini the built in test server just needs the config file entry, that's all it needs.
blowdart