System.Security 无法将类型为“System.Security.Principal.WindowsIdentity”的对象强制转换为类型“System.Web.Security.FormsIdentity”。
2009-11-27 13:51
826 查看
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"/>
今天在编写代码是:无法将类型为“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"/>
相关文章推荐
- 无法将类型为“System.Security.Principal.GenericIdentity”的对象强制转换为类型“System.Web.Security.FormsIdentity”的错误
- 【Winform】 无法将类型为“System.Windows.Forms.SplitContainer”的对象强制转换为类型“System.ComponentModel.ISupportInitialize”。
- 保存图片控件上的图片到本地 出现错误:无法将类型为“System.Windows.Media.Imaging.BitmapFrameDecode”的对象强制转换为类型“System.Windows.Media.Imaging.BitmapImage”。
- 无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.TextBox
- 无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型
- 无法将类型为“System.Web.UI.WebControls.HiddenField”的对象强制转换为类型的错误的解决
- 无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.Text
- 无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.TextBox”的解决方法
- System.Windows.Forms.SplitContainer”的对象强制转换为类型“System.ComponentModel.ISupportInitialize”失败
- 出现无法将System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.DropDownList的解决方法
- 莫名的无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为XXX问题
- 解决无法将类型为“System.Web.UI.WebControls.HiddenField”的对象强制转换为类型的错误
- 无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web
- 解决:GridView提示无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型...
- 无法将类型为“System.DBNull”的对象强制转换为类型“System.Byte[]”
- c # xml操作 (无法将类型为“System.Xml.XmlComment”的对象强制转换为类型“System.Xml.XmlElement”)
- “WebProxyWrapper”的对象强制转换为类型“System.Net.WebProxy
- C#在父窗口中调用子窗口的过程(无法访问已释放的对象)异常,不存在从对象类型System.Windows.Forms.DateTimePicker到已知的托管提供程序本机类型的映射。
- 无法将类型为“System.Data.Common.DbDataRecord”的对象强制转换为类型“