我们的客户中很少有人经常收到无效的强制转换异常,有变体,即InvalidCastException
/ ProviderException
,但都是从方法调用产生的:System.Web.Security.SqlRoleProvider.GetRolesForUser(String username)
另一个变体是:
异常类型:
InvalidCastException
异常消息:无法将类型的对象System.Int32
转换为 typeSystem.String
。
我查看了应用程序事件日志,其中显示:
Stack trace:
at System.Web.Security.SqlRoleProvider.GetRolesForUser(String username)
at System.Web.Security.RolePrincipal.IsInRole(String role)
at System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal)
at System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb)
at System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)*
有没有人遇到过这个问题,如果有,解决方法是什么?
谢谢
JS