“/11”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 82: int count = 0;
行 83: string strUserName = " ";
行 84: strUserName = Session["UserName"].ToString();
行 85: string newcount = " ";
行 86: SqlCommand comm = new SqlCommand();
源文件: d:\lishisheng\11软件\LeftTree.aspx.cs 行: 84 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
LeftTree.Page_Load(Object sender, EventArgs e) in d:\11\11软件\LeftTree.aspx.cs:84
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 82: int count = 0;
行 83: string strUserName = " ";
行 84: strUserName = Session["UserName"].ToString();
行 85: string newcount = " ";
行 86: SqlCommand comm = new SqlCommand();
源文件: d:\lishisheng\11软件\LeftTree.aspx.cs 行: 84 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
LeftTree.Page_Load(Object sender, EventArgs e) in d:\11\11软件\LeftTree.aspx.cs:84
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
解决方案 »
- 自定义控件问题
- ASP.NET(VB)学习
- 各位大侠,有谁用过report machine设计报表时,如何像excel那样,实现报表内数据相加,就是F6=F3+B3这样
- asp.net 实现鼠标悬停显示图片
- 关于三层结构各层责任的问题
- 大家好,用dreamweaver打开*.js文件的时候,都是自动用utf-8编码打开,不能修改...?
- 关于DropDownList的怪事
- 做个考试系统,碰到提交答案时的一个问题,.....................
- asp.net项目无法更改输出路径
- C#中有去字符串首尾空格的函数吗?是什么?
- 关于GridView
- 正则表达式,怎么把以"first"开头,"end."结尾的字符串替换为"myword"?
你应该判断一下
这个东西,你看看,是不是不存在.如果你单测这个东西,不是从过程上走的话,可能会取不到这个值的..
{
Response.Write("Session是空的,想把null值ToString()当然会异常了")
}
if(Session["UserName"]!=null)
strUserName = Session["UserName"].ToString();
if(Session["UserName"] != null)
{
strUserName = Session["UserName"].ToString();
string newcount = " ";
SqlCommand comm = new SqlCommand();
.....
}