我在一个窗口使用Session,有值 .如下CBID=Request.QueryString["cbid"]==null?0:Convert.ToInt32(Request.QueryString["cbid"]);
UserId=Session["LoginUserID"].ToString()==""?0:Convert.ToInt32(Session["LoginUserID"].ToString());
TrueName=Session["LoginTrueName"].ToString()==""?"":Session["LoginTrueName"].ToString(); 在当前窗口,我用widow.open打开窗口,新窗口也使用session出现下列错误
“/flow”应用程序中的服务器错误。
-------------------------------------------------------------------------------- 未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。 源错误:
行 57: // 在此处放置用户代码以初始化页面
行 58: CBID=Request.QueryString["cbid"]==null?0:Convert.ToInt32(Request.QueryString["cbid"]);
行 59: UserId=Session["LoginUserID"].ToString()==""?0:Convert.ToInt32(Session["LoginUserID"].ToString());
行 60: TrueName=Session["LoginTrueName"].ToString()==""?"":Session["LoginTrueName"].ToString();
行 61: Response.Expires = -1000;
源文件: d:\流程文档\flow\document\printdocument.aspx.cs 行: 59 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
Flow.Document.PrintDocument.Page_Load(Object sender, EventArgs e) in d:\流程文档\flow\document\printdocument.aspx.cs:59
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.2032; ASP.NET 版本:1.1.4322.2032
UserId=Session["LoginUserID"].ToString()==""?0:Convert.ToInt32(Session["LoginUserID"].ToString());
TrueName=Session["LoginTrueName"].ToString()==""?"":Session["LoginTrueName"].ToString(); 在当前窗口,我用widow.open打开窗口,新窗口也使用session出现下列错误
“/flow”应用程序中的服务器错误。
-------------------------------------------------------------------------------- 未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。 源错误:
行 57: // 在此处放置用户代码以初始化页面
行 58: CBID=Request.QueryString["cbid"]==null?0:Convert.ToInt32(Request.QueryString["cbid"]);
行 59: UserId=Session["LoginUserID"].ToString()==""?0:Convert.ToInt32(Session["LoginUserID"].ToString());
行 60: TrueName=Session["LoginTrueName"].ToString()==""?"":Session["LoginTrueName"].ToString();
行 61: Response.Expires = -1000;
源文件: d:\流程文档\flow\document\printdocument.aspx.cs 行: 59 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
Flow.Document.PrintDocument.Page_Load(Object sender, EventArgs e) in d:\流程文档\flow\document\printdocument.aspx.cs:59
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.2032; ASP.NET 版本:1.1.4322.2032
http://community.csdn.net/Expert/topic/4977/4977307.xml?temp=.5211298
http://www.chinaaspx.com/Comm/Dotnetbbs/Showtopic.aspx?Forum_ID=5&Id=244187&PPage=1
int nUserID = 0;
if( Session[ "LoginUserID" ] != null )
{
nUserID = Convert.ToInt32( Session[ "LoginUserID" ] );
}
Session[ "LoginUserID" ]可能为null