Reputation: 321
I'm new to IIS 7.5 and I am trying to get a site working with Windows Authentication. It's an ASP.NET 4.0 application which is set up as an application under the default website and it is running the ASP.NET 4 app pool. The application is set up with Anonymous Authentication disabled and Windows Authentication enabled.
The site is not authenticating properly - I can see an error in the event log (this is a Null Reference
error to do with some code that uses Context.User
) and the detail says IsAuthenticated=False
and the User
is blank.
I have set Authentication Mode = Windows
under <system.web>
in my Web.config and have tried various other config settings without success.
I've tried using the ASP.NET classic app pool but get an error
Handler "ExtensionlessUrl-ISAPI-4.0_64bit" has a bad module "IsapiModule" in its module list
I'd prefer to get it working using the ASP.NET 4 app pool if possible. Can anyone advise what I need to do?
Upvotes: 0
Views: 7302
Reputation: 17519
Take a look at IIS Express Windows Authentication
Only difference is, IIS 7.5 applicationhost.config
file is located at %systemroot%\System32\inetsrv\config\applicationHost.config
Upvotes: 0
Reputation: 321
Sorry, I forgot to post the answer when I found it. In actual fact there was nothing wrong with the authentication configuration, it was to do with my referencing Context.User too early in Global.asax.
In the new integrated mode the authentication works differently to classic mode and in the Application_AuthenticateRequest event in Global.asax the authentication hasn't happened yet so Context.User is null hence the exception I got and the fact that the log shows IsAuthenticated as false. I moved the line of code that calls Context.User into Application_PostAuthenticateRequest and it's working now.
Upvotes: 1