Ral*_*ton 6 asp.net-membership
在Application_AuthenticationRequest的global.asax文件中,我将Thread.CurrentPrincipal设置为自定义主体.我还将HttpContext.Current.User设置为相同的主体.
但是后来在应用程序中,当我需要将Thread.CurrentPrincipal强制转换为我们的自定义类型时,我收到一个运行时错误:无法将类型为"System.Web.Security.RolePrincipal"的对象强制转换为"OurCustomPrincipal".
Thread.CurrentPrincipal是如何重置为RolePrincipal的,更重要的是我如何将它保存在我们在global.asax中设置的CustomPrincipal中
提前致谢
小智 6
你肯定已经解决了你的问题但是以防万一,如果你使用ASP.NET的RoleProvider,RoleManagerModule会覆盖FormsAuthenticationModule创建的GenericPrincipal对象,并在PostAuthenticateRequest期间用RolePrincipal对象替换它: http:// www .asp.net /学习/安全/教程-11-vb.aspx
| 归档时间: |
|
| 查看次数: |
4197 次 |
| 最近记录: |