Session["CMESM_USER_ID"]
改为
HttpContext.Current.Session["CMESM_USER_ID"]

解决方案 »

  1.   

    改成HttpContext.Current.Session["CMESM_USER_ID"],
    系统提示:
    =================================================
    未将对象引用设置到对象的实例。 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 
    行 18:  {
    行 19:  // 判断用户是否登录
    行 20:  if (HttpContext.Current.Session["CMESM_USER_ID"] == null && HttpContext.Current.Session["CMESM_USER_ID"].ToString() == "")
    行 21:  {
    行 22:  Response.Write("no login");
     ==========================================================
    这个问题我以前就遇到了,
    不过没有解决。
      

  2.   

    using System.Web.SessionState;
    这个有吗?
      

  3.   

    using System.Web.SessionState;
    我后来加了,
    还是一样的问题。
      

  4.   

    Session["CMESM_USER_ID"] == null || Session["CMESM_USER_ID"].ToString() == "")
                                     --试试
      

  5.   

    将&& 改成 || 还是不行!!!
    晕&*(*%&^*__)**%^$$%$##&^&&*
      

  6.   

    先要判断HttpContext.Current不为空,然后再判断Session:if(HttpContext.Current != null && HttpContext.Current.Session["CMESM_USER_ID"] == null)
      

  7.   

    chnking(kent) 的方法还是不行。
    !!!!
      

  8.   

    和我以前遇到的问题一模一样,请参考http://expert.csdn.net/Expert/topic/1756/1756750.xml?temp=.5516931
      

  9.   

    让你非用C#,用vb.net很好,没有这种屎问题
      

  10.   

    不是,因为在基类的构造函数执行的时候session还未构造成功呢。语句换个地方就行了,老兄。
      

  11.   

    /// <summary>
    /// 校验Session是否超时,超时转到错误页面
    /// </summary>
    /// <param name="e"></param>
    override protected void OnLoad(EventArgs e)
    {
    if (Session["CMESM_USER_ID"] == null && Session["CMESM_USER_ID"].ToString() == "")
    {
    Response.Write("no login");
    } base.OnLoad(e);
    }
      

  12.   

    peczar(冷漠热心)
    ths!
    问题终于解决了,
    现在没空,
    待会给分。