问题描述
各位,以下问题怎么解决,下面是错误源码:<html><head><title>未将对象引用设置到对象的实例。</title><style>body{font-family:"Verdana";font-weight:normal;font-size:.7em;color:black;}p{font-family:"Verdana";font-weight:normal;color:black;margin-top:-5px}b{font-family:"Verdana";font-weight:bold;color:black;margin-top:-5px}H1{font-family:"Verdana";font-weight:normal;font-size:18pt;color:red}H2{font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon}pre{font-family:"LucidaConsole";font-size:.9em}.marker{font-weight:bold;color:black;text-decoration:none;}.version{color:gray;}.error{margin-bottom:10px;}.expandable{text-decoration:underline;font-weight:bold;color:navy;cursor:hand;}</style></head><bodybgcolor="white"><span><H1>“/”应用程序中的服务器错误。<hrwidth=100%size=1color=silver></H1><h2><i>未将对象引用设置到对象的实例。</i></h2></span><fontface="Arial,Helvetica,Geneva,SunSans-Regular,sans-serif"><b>说明:</b>执行当前Web请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。<br><br><b>异常详细信息:</b>System.NullReferenceException:未将对象引用设置到对象的实例。<br><br><b>源错误:</b><br><br><tablewidth=100%bgcolor="#ffffcc"><tr><td><code>执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code></td></tr></table><br><b>堆栈跟踪:</b><br><br><tablewidth=100%bgcolor="#ffffcc"><tr><td><code><pre>[NullReferenceException:未将对象引用设置到对象的实例。]CSWeb.Member.upcompany.initpage()+2784CSWeb.Member.upcompany.Page_Load(Objectsender,EventArgse)+289System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtrfp,Objecto,Objectt,EventArgse)+14System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Objectsender,EventArgse)+35System.Web.UI.Control.OnLoad(EventArgse)+99System.Web.UI.Control.LoadRecursive()+50System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)+627</pre></code></td></tr></table><br><hrwidth=100%size=1color=silver><b>版本信息:</b> Microsoft.NETFramework版本:2.0.50727.3623;ASP.NET版本:2.0.50727.3618</font></body></html><!--[NullReferenceException]:未将对象引用设置到对象的实例。在CSWeb.Member.upcompany.initpage()在CSWeb.Member.upcompany.Page_Load(Objectsender,EventArgse)在System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtrfp,Objecto,Objectt,EventArgse)在System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Objectsender,EventArgse)在System.Web.UI.Control.OnLoad(EventArgse)在System.Web.UI.Control.LoadRecursive()在System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)[HttpUnhandledException]:引发类型为“System.Web.HttpUnhandledException”的异常。在System.Web.UI.Page.HandleError(Exceptione)在System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)在System.Web.UI.Page.ProcessRequest(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)在System.Web.UI.Page.ProcessRequest()在System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContextcontext)在System.Web.UI.Page.ProcessRequest(HttpContextcontext)在ASP.member_upcompany_aspx.ProcessRequest(HttpContextcontext)在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()在System.Web.HttpApplication.ExecuteStep(IExecutionStepstep,Boolean&completedSynchronously)--><!--此错误页可能包含敏感信息,因为ASP.NET通过<customErrorsmode="Off"/>被配置为显示详细错误信息。请考虑在生产环境中使用<customErrorsmode="On"/>或<customErrorsmode="RemoteOnly"/>。-->
解决方案
解决方案二:
贴出CSWeb.Member.upcompany.Page_Load这个Page_Load里的方法出来看看。可能的原因是:当你参数不存在时,Request.QueryString("OutlineID")为NULL值,这个时候你怎么能把它ToString()呢,在空值上操作肯定是要报你空引用的错误的!!