Michele Benolli
Michele Benolli

Reputation: 65

Can't Get Windows Authentication to Work

I tried to create an authentication system in aspx using Windows Authentication. It seems to be the default mode for authenticating users in an intranet, for a company using Windows PCs. I enabled 'Windows Authentication' for my site in IIS, and disabled the other types of Authentications. This is my Web.config file:

<system.web>
    <authentication mode="Windows" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
</system.web>

What I have is a feedback provided by this line in my code (always false)

Response.Write(User.Identity.IsAuthenticated.ToString());

I'm not sure I'm doing all in the right way, but I've read many tutorials and all seems so easy... so, what I miss to do? I'm doing something wrong?

I haven't found anything that helped me in the implementation, simply all what I wrote seems to do nothing. Uh, also I don't see the Windows Auth Dialog

Upvotes: 0

Views: 375

Answers (2)

Michele Benolli
Michele Benolli

Reputation: 65

I solved adding a row in 'Authorization Rules' in IIS. In my company we all are admin, so I added an allow rule for admin users and I denied the access for others. All works correctly now, I show the Windows Auth Dialog and with username and password I am able to authenticate.

Upvotes: 1

Mark Shevchenko
Mark Shevchenko

Reputation: 8197

Check these requirements:

  1. Windows authentication is enabled in IIS (you did it already).
  2. Anonymous access is disabled in IIS (http://technet.microsoft.com/en-us/library/cc731244(v=ws.10).aspx).
  3. Windows authentication is enabled in client's Internet Explorers.
  4. impersonation is switched on in web.config ( http://msdn.microsoft.com/en-us/library/134ec8tc(v=vs.140).aspx).

As far as I remember, that's all.

Upvotes: 0

Related Questions