如何设置Session的有效时间,
并且在程序中判断Session是否过期,
如果过期了,则跳转到登录界面???

解决方案 »

  1.   

    if(request.getSession(false)==null)
     System.out.println("已过期");
    else
     system.out.println("没有过期");
      

  2.   

    web.config中设置session过期时间
       <sessionState mode="StateServer" timeout="20"/>
      

  3.   

    session默认20 分钟
    if(Session[""]==null)Response.Redirect("login.aspx");
      

  4.   

    sessionserver
      

  5.   

    可以写个基类;然后每个页面都继承这个类,在基类中对session[""] == null进行判断
      

  6.   

    设置session有效时间web.config
    <sessionState .........timeout='60'/>
    并且在程序中判断Session是否过期,
    如果过期了,则跳转到登录界面???
    web.config
    <authentication mode="Forms">
      <forms loginUrl="Login.aspx" name="anquan" timeout="10"/>
    </authentication>
     
      

  7.   

    直接在程序中设置Session.Timeout = 时间;
    if(Session[""]==null)Response.Redirect("login.aspx");
      

  8.   

    session有好几种方式使用
    mode设置将Session信息存储到哪里
     InProc
     设置为将Session存储在进程内,就是ASP中的存储方式,这是默认值。
     StateServer
     设置为将Session存储在独立的状态服务中。
     SQLServer
     设置将Session存储在SQL Server中。
     具体看下说明就OK了!