在ASP.NET中拒绝用户时,’CustomIdentity’上的SerializationException
我尝试在现有数据库的基础上实现ASP.NET身份验证和授权.
只要允许用户访问该页面,它就能完美运行.但是当用户被拒绝时,框架会在我的CustomIdentity上抛出序列化异常,而不是抛出AccessDeniedException. 我的例外情况与上面的链接完全相同 Type is not resolved for member'CW.CustomAuthentication.CWIdentity,CW.CustomAuthentication,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'CW.CustomAuthentication.CWIdentity,PublicKeyToken=null'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SerializationException: Type is not resolved for member 'CW.CustomAuthentication.CWIdentity,PublicKeyToken=null'.] Microsoft.VisualStudio.WebHost.Connection.get_RemoteIP() +0 Microsoft.VisualStudio.WebHost.Request.GetRemoteAddress() +65 System.Web.HttpRequest.get_UserHostAddress() +18 System.Web.HttpRequest.get_IsLocal() +13 System.Web.Configuration.CustomErrorsSection.CustomErrorsEnabled(HttpRequest request) +86 System.Web.HttpContext.get_IsCustomErrorEnabled() +42 System.Web.Configuration.UrlAuthFailedErrorFormatter.GetErrorText(HttpContext context) +16 System.Web.Security.UrlAuthorizationModule.WriteErrorMessage(HttpContext context) +29 System.Web.Security.UrlAuthorizationModule.OnEnter(Object source,EventArgs eventArgs) +8777783 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +75 同时使用会员资格和自定义IIdentity和IPrincipal是否正确? 最好的祝福, Stephane Erbrech 解决方法经过一些更多的测试,根据我发布的链接说,似乎只有当我从visual studio运行调试模式时才会发生此错误.如果我将项目设置为在IIS中运行,则错误消失,安全实现按预期工作.—这是Visual Studio中实现的轻量级网络服务器中的一个错误吗?— 编辑:您可以进入Web项目的属性,转到“Web”选项卡,然后选中“使用本地IIS服务器”.但是,这将要求您以管理员身份运行Visual Studio并在计算机上安装IIS,以便VS在加载项目时可以在本地IIS服务器中创建虚拟目录. (编辑:十堰站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – 干净的方式来防止输入按钮提交表单
- asp.net中让Repeater和GridView支持DataPager分页
- asp.net Xml绑定到数据控件的具体实现
- 用AJAX实现的无刷新的分页实现代码(asp.net)
- asp-classic – 哪里可以存储经典ASP的连接字符串?
- asp.net – 使用WebMethods和session时的最佳实践
- asp.net-mvc – 在ClaimsIdentity上,BootstrapContext为nul
- asp.net-mvc – 发现MVC项目中是否使用views / partials
- 优化 – 字典/客户端VS应用程序变量
- Asp.NetCore1.1版本去掉project.json后如何打包生成跨平台包
- asp.net中的GridView分页问题
- asp.net-mvc – 如何使输入字段仅允许使用EF和数
- 无法通过IP地址连接ASP.NET开发服务器(VS2010)
- asp.net – ASP:ItemTemplate中的DropDownList:
- 实体框架 – 等同于.HasOptional在实体框架核心1
- asp.net – 获得“System.Web.Mvc.Html.MvcForm”
- asp.net – “2015年4月20日Google帐户的OpenID2
- 在asp.net中HttpContext.Current.User和Thread.C
- asp.net – 登录后对Membership.GetAllUsers()的
- ASP.NET MVC API 接口验证的示例代码