请问怎么样判断一个用户是否已经登陆!??? 其中用户的唯一标识UId 存在Session["UId"]里面------------------------------------------谢谢各位大哥指教!!!!!!!!

解决方案 »

  1.   

    string userID =(Session["UId"]!=null)?Session["UId"].ToString():"" ;
    if( userID.length == 0) 
    {
       //没有登录处理
    }
    else
    {
      //登录后处理
    }
      

  2.   

    如果Session["UId"]不为空就已经登陆了,空的话就未登陆
      

  3.   

    if(this.Session["logid"]==null)
    {
    this.Response.Writ("<scriptlanguage='javascript'>top.location.href='../index.aspx';</script>");
    this.Response.End();
    //this.Response.Redirect("../index.aspx");
    }
    //如果是派出所用户,不能查看缴费管理
    if(this.Session["level"].ToString()=="2")
    {
    // this.Response.Write("<script language='javascript'>top.location.href='../index.aspx';</script>");
    this.Response.Redirect("error.aspx");
    this.Response.End();
    }