“/bgzdh”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 36: if (this.IsPostBack)
行 37: return;
行 38: if( this.Session["Flag"].ToString() == "1" )
行 39: {
行 40: cxtj = "01";
源文件: c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs 行: 38 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
bgzdh.W_mainmeun_wqz.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs:38
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 36: if (this.IsPostBack)
行 37: return;
行 38: if( this.Session["Flag"].ToString() == "1" )
行 39: {
行 40: cxtj = "01";
源文件: c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs 行: 38 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
bgzdh.W_mainmeun_wqz.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs:38
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
解决方案 »
- 哪位高手讲讲三层架构我在网上找了好多资料还是看不懂
- 请问有什么办法或工具可以查出我自己用.net开发的一个WinForm系统有的时候CPU占用率很高的原因?
- SQL2005 相对路径
- 如何可以在过程中等待事件结束后才干下一步事情?谢谢,在线等待!
- htmltanble 中动态根据第一行中的列数在下面生成列??????????
- 数据长度
- 汗!求从DataGrid 删除数据的例子
- 在C#.net中能实现一个DataGrid单元格内放两个linkbutton吗?-----多谢!!
- 如何将窗体客户区图象转存到Image中?
- 原码查错,在线等待!(这是个数据解析模块,提供测试原码,有解决办法的全部加分!)
- 多线程Monitor的使用问题!
- 如何让我的combobox具有我需要的功能
“/bgzdh”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 36: if (this.IsPostBack)
行 37: return;
行 38: if( this.Session["Flag"].ToString() == "null" )
行 39: {
行 40: cxtj = "01";
源文件: c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs 行: 38 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
bgzdh.W_mainmeun_wqz.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs:38
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
return;
if( this.Session["Flag"] != null)
{
if (Session["Flag"].ToString() == "1")
{
//这里再加入代码
}
}
先要判断Session不为空你该这么写
if(Session["Flag"]!=null)
{
if(Session["Flag"].ToString()=="1")
{
//你的操作
}
}
if(this.Session["Flag"]!=null)
{
}
{
if(Session["Flag"].ToString()=="1")
{
}
}
{
cxtj = "01";
// Label2.Text = " 发文管理 " ;
Image2.ImageUrl = "images/a1.jpg" ;
}
else
{
cxtj = this.Session["PartId"].ToString().Trim() ;
cxtj = cxtj + "" ;
if(cxtj.Trim() == "01")
{
Image2.ImageUrl = "images/a1.jpg" ;
}
if(cxtj.Trim() == "02")
{
Image2.ImageUrl = "images/a2.jpg" ;
}
if(cxtj.Trim() == "03")
{
Image2.ImageUrl = "images/a3.jpg" ;
}
if(cxtj == "04")
{
Image2.ImageUrl = "images/a4.jpg" ;
}
if(cxtj == "05")
{
Image2.ImageUrl = "images/a5.jpg" ;
}
if(cxtj == "06")
{
Image2.ImageUrl = "images/a6.jpg" ;
}
if(cxtj == "08")
{
Image2.ImageUrl = "images/a9.jpg" ;
}
}
“/bgzdh”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误:
行 81: }
行 82: }
行 83: string name = this.Session["username"].ToString().Trim() ;
行 84: name = name + "" ;
行 85: Label1.Text = " 欢迎你:" + name.Trim() ;
源文件: c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs 行: 83 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
bgzdh.W_mainmeun_wqz.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\bgzdh\w_mainmeun_wqz.aspx.cs:83
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
if( this.Session["Flag"].ToString() == "1" )
{
cxtj = "01";
// Label2.Text = " 发文管理 " ;
Image2.ImageUrl = "images/a1.jpg" ;
}
else
{
cxtj = this.Session["PartId"].ToString().Trim() ;
cxtj = cxtj + "" ;
if(cxtj.Trim() == "01")
{
Image2.ImageUrl = "images/a1.jpg" ;
}
if(cxtj.Trim() == "02")
{
Image2.ImageUrl = "images/a2.jpg" ;
}
if(cxtj.Trim() == "03")
{
Image2.ImageUrl = "images/a3.jpg" ;
}
if(cxtj == "04")
{
Image2.ImageUrl = "images/a4.jpg" ;
}
if(cxtj == "05")
{
Image2.ImageUrl = "images/a5.jpg" ;
}
if(cxtj == "06")
{
Image2.ImageUrl = "images/a6.jpg" ;
}
if(cxtj == "08")
{
Image2.ImageUrl = "images/a9.jpg" ;
}
}
一个就是上面兄弟们说的if( this.Session["Flag"].ToString() == "1" )
之前要判断是否为空。另一个地方就是这里:
行 83: string name = this.Session["username"].ToString().Trim() ;
同样要在trim之前判断是否为空.
“/bgzdh”应用程序中的服务器错误。
未将对象引用设置到对象的实例。
行 83: string name = this.Session["username"].ToString().Trim() ;
同样要在trim之前判断是否为空.
还是提示这个
“/bgzdh”应用程序中的服务器错误。
未将对象引用设置到对象的实例。
我的问题还没解决呢!!!!
其实我在这个出错页面下做一个TREEVIEW可是死活不显示