System.Security 无法将类型为“System.Security.Principal.WindowsIdentity”的对象强制转换为类型“System.Web.Security.FormsIdentity”。

2009年11月27日

今天在编写代码是:无法将类型为“System.Security.Principal.WindowsIdentity”的对象强制转换为类型“System.Web.Security.FormsIdentity”。

解决办法如下:

 

 <authentication mode="Windows"/>
  <!--
            如果在执行请求的过程中出现未处理的错误,
            则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
            开发人员通过该节可以配置
            要显示的 html 错误页
            以代替错误堆栈跟踪。

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->

注意红色字体:

改为: <authentication mode="Forms"/>

 

posted on 2009-11-27 13:51  遥望大海,云卷云舒  阅读(5494)  评论(2编辑  收藏  举报