'/'应用程序中的服务器错误。键不能为空。参数名称:key

时间:2012-12-16 09:53:50

标签: c# asp.net

有时候我会回到制作报告的问题,我将其用于刺激计划的报告:

Key cannot be null.
Parameter name: key
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.ArgumentNullException: Key cannot be null.
Parameter name: key

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:

[ArgumentNullException: Key cannot be null.
Parameter name: key]
System.Collections.Specialized.HybridDictionary.get_Item(Object key) +6238250
System.Web.Security.RolePrincipal.IsInRole(String role) +231
System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal) +132
System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb) +264
System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb) +201
System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +9025485
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

我们如何解决?

TNX

1 个答案:

答案 0 :(得分:2)

System.Collections.Specialized.HybridDictionary.get_Item(Object key)
                                                                 ^
                                                  Key cannot be null.

在源代码中找到按键获取HybridDictionary项的位置,并检查该键是否为空。

相关问题