调用页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 
大家帮忙看看怎么回事?

解决方案 »

  1.   

    (1)要是session超时的话为什么本地又没问题呢? 
    (2)如何解决超时问题?
      

  2.   

    自己顶一下。
    我程序里面的webconfig 的 session 的 timeout 设为120的。
    这样还会是session的问题吗?
      

  3.   

    谁来解答一下?会不会是iis里面的session时间问题呢?
      

  4.   

    应该不会是session 的问题 因为它本来是 存在服务器的。
    加个try 看能不能过去。发布其他程序有吗?
    我想判断是不是 iss 配置有问题。
      

  5.   


    有发布其他程序,但都不是.net的。iis里只有我发布的程序
      

  6.   

    哪位老兄帮忙看看?iis 已经设为 asp.net2.0 
    程序文件夹已经设为ervery one 控制所有权限而且程序在本地运行是没问题的。
      

  7.   


    DataSet ds = cmd.getDataSet(strSql); 
    //ds Maybe null
      

  8.   


    这个是不为空的,我在本地用同样的数据测过。是不是DBNull.Value == Session["UserInfo"] || (object)Session["UserInfo"] == null 这个的错呢?
      

  9.   

    楼主建议你的代码中的变量c,uc Labmotherplate,ds ,反正就是一切有引用变量的地方都判断一下是不是null,以防出现null的错误。
      

  10.   

    combinelist() 里面的 cmd = null 吧?