很奇怪的问题,我再用别人设计的页面作网站,但是无法使用Session,
就连 Session["a"] == null 这样的判断 一执行就会出错的,出错信息是Session为空。
还有就是自定义控件,无论我怎么做,在后台就是得不到实例,也是报告 对象从未实例化问题可能出在那里?那位高人指点一下。

解决方案 »

  1.   

    System.Web.HttpContext.Current.Session["a"] == null
      

  2.   

    我试过了,还是不行的string username = System.Web.HttpContext.Current.Session["_customer_user"].ToString();{"未将对象引用设置到对象的实例。" } System.Exception
      

  3.   

    我是在用户控件里面写的,刚刚改了一下,
     myControl.Session["aa"] = Session["aa"];
     把页面的Session,赋值给我自己写的用户控件,这样在控件里面就可以访问控件的Session了。