发生类型为 System.Web.HttpUnhandledException 的异常

来源:百度知道 编辑:UC知道 时间:2024/06/01 11:14:46
Error Stack:
System.Web.HttpUnhandledException: 发生类型为 System.Web.HttpUnhandledException 的异常。 ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
at Kingbo.WebModules.Repository.Web.Controls.User.OutlineCategory.Page_Load(Object sender, EventArgs e) in E:\精博网络\学习网代码\kingbo\WebModules\Training\OutlineCategory.ascx.vb:line 51
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
--- 内部异常堆栈跟踪的结尾 ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.

原因:当你参数不存在时,Request.QueryString("OutlineID")为NULL值,这个时候你怎么能把它toString()呢,在空值上操作当要报你空引用的错误.

解决:Request.QueryString("OutlineID")可直接做字符串使用,不需要toString()