2
votes

We are getting a null reference exception from the following line in iis 7.5

if (!User.Identity.IsAuthenticated)

we are using forms authentication and also have anonymous authentication enabled. This works just fine in iis 7. Following is our configuration in web.config

<authentication mode="Forms">
        <forms name=".ASPXAUTH" loginUrl="/Auth/Login" defaultUrl="/" timeout="600" path="/" />
    </authentication>
    <authorization>
        <deny users="?" />
        <allow users="*" />
    </authorization>
    <identity impersonate="true" />

This form authentication option also doesn't show up under iis site authentication configuration for this site. The only options I see there are Anonymous Authentication and ASP.NET Impersonation.

enter image description here

So, maybe it is not reading from Web.config for some reason? Any help is greatly appriciated.

1
Have you defined the account you want to use for impersonation? - David W
Yes, we are just using Network Service for application pool identity. - devmet

1 Answers

1
votes

This is fixed. I saw that the site didn't have references to FormsAuthentication and Anonymousidentificationmodule. I ran aspnet_regiis -i for asp.net 4.0 and now the site works fine.