调用页aspx:page_load :
if (Session["ddd"] != null)
{
String combine = Session["ddd"].ToString().TrimEnd(','); string[] sArray = combine.Split(',');
for (int j = 0; j < sArray.Length; j++)
{ string[] pArray = sArray[j].Split('|');
string motherplatebarcode = pArray[0];
string platebarcode1 = pArray[2];
string projectcode = pArray[1]; Control c = Page.LoadControl("abc.ascx");
c.ID = platebarcode1.Trim();
this.addpanel.Controls.Add(c); string platebarcode = platebarcode1.Trim();
abc uc = (abc)this.addpanel.FindControl(platebarcode); #region Label Labmotherplate = (Label)uc.FindControl("Lab_motherplate");
Labmotherplate.Text = motherplatebarcode;
#endregion
}
}
用户控件主要代码:page_load: private void combinelist()
{
string strSql = "select * from table1";
DataSet ds = cmd.getDataSet(strSql);
int introw = ds.Tables[0].Rows.Count;
if (introw > 0)
{
Gridview1.DataSource = ds;
Gridview1.DataBind();
Gridview1.Visible = true;
}
}问题:
在本地上运行没有什么问题,但是部署到服务器以后出现了一下问题:
Server Error in '/web' Application.
-------------------------------------------------------------------------------- Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
singletonsetdone.combinelist() +493
singletonsetdone.Page_Load(Object sender, EventArgs e) +21
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +106
大家帮忙看看怎么回事?
if (Session["ddd"] != null)
{
String combine = Session["ddd"].ToString().TrimEnd(','); string[] sArray = combine.Split(',');
for (int j = 0; j < sArray.Length; j++)
{ string[] pArray = sArray[j].Split('|');
string motherplatebarcode = pArray[0];
string platebarcode1 = pArray[2];
string projectcode = pArray[1]; Control c = Page.LoadControl("abc.ascx");
c.ID = platebarcode1.Trim();
this.addpanel.Controls.Add(c); string platebarcode = platebarcode1.Trim();
abc uc = (abc)this.addpanel.FindControl(platebarcode); #region Label Labmotherplate = (Label)uc.FindControl("Lab_motherplate");
Labmotherplate.Text = motherplatebarcode;
#endregion
}
}
用户控件主要代码:page_load: private void combinelist()
{
string strSql = "select * from table1";
DataSet ds = cmd.getDataSet(strSql);
int introw = ds.Tables[0].Rows.Count;
if (introw > 0)
{
Gridview1.DataSource = ds;
Gridview1.DataBind();
Gridview1.Visible = true;
}
}问题:
在本地上运行没有什么问题,但是部署到服务器以后出现了一下问题:
Server Error in '/web' Application.
-------------------------------------------------------------------------------- Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
singletonsetdone.combinelist() +493
singletonsetdone.Page_Load(Object sender, EventArgs e) +21
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +106
大家帮忙看看怎么回事?
(2)如何解决超时问题?
我程序里面的webconfig 的 session 的 timeout 设为120的。
这样还会是session的问题吗?
加个try 看能不能过去。发布其他程序有吗?
我想判断是不是 iss 配置有问题。
有发布其他程序,但都不是.net的。iis里只有我发布的程序
程序文件夹已经设为ervery one 控制所有权限而且程序在本地运行是没问题的。
DataSet ds = cmd.getDataSet(strSql);
//ds Maybe null
这个是不为空的,我在本地用同样的数据测过。是不是DBNull.Value == Session["UserInfo"] || (object)Session["UserInfo"] == null 这个的错呢?