简体   繁体   English

iis 7.5中的null user.identity

[英]null user.identity in iis 7.5

We are getting a null reference exception from the following line in iis 7.5 我们从iis 7.5的以下行获取空引用异常

if (!User.Identity.IsAuthenticated) 如果(!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 在iis 7中可以正常工作。以下是我们在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. 此表单身份验证选项也不会显示在此站点的iis站点身份验证配置下。 The only options I see there are Anonymous Authentication and ASP.NET Impersonation. 我看到的唯一选项是匿名身份验证和ASP.NET模拟。

在此处输入图片说明

So, maybe it is not reading from Web.config for some reason? 因此,也许由于某种原因它没有从Web.config中读取? Any help is greatly appriciated. 任何帮助都非常有用。

This is fixed. 这是固定的。 I saw that the site didn't have references to FormsAuthentication and Anonymousidentificationmodule. 我看到该站点没有对FormsAuthentication和Anonymousidentificationmodule的引用。 I ran aspnet_regiis -i for asp.net 4.0 and now the site works fine. 我为asp.net 4.0运行了aspnet_regiis -i,现在该站点运行正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM