当用户登录后,如果2分钟内没有对页面进行操作,就自动退出,返回到首页!!
请问高手怎么设置,谢谢先!!!

解决方案 »

  1.   

    use javascript, for example:
    <script language="javascript">
    var timer = null;
    var n = 120000; //2 minutesfunction window.onload()
    {
      setUpTimer();
    }function document.onmouseover()
    {
      setUpTimer();
    }function document.onkeydown()
    {
     setUpTimer();
    }function setUpTimer()
    {
     if (timer != null)
       clearTimeout(timer); timer = setTimeout("redir()", n);
    }function redir()
    {
      window.location.href = "http://localhost/index.aspx";
    }
    </script>
      

  2.   

    Response.Write("2分钟后页面将自动跳转到最初页面");
    System.Threading.Thread.Sleep(new TimeSpan(0,0,0,120,0));
    Response.Redirect("./default.aspx");
      

  3.   

    在<head>...</head>中加入:
    <% =strMeta %>
    然后在代码中声明一个变量:
    protected string strMeta;
    在Button_Click中加入:
    strMeta = "<meta http-equiv='refresh' content='10;URL=./default.aspx'>";
      

  4.   

    不能在WEB.CONFIG里面设置吗??
      

  5.   

    一个网站也,不可能每个页面都这么设置把??
    能不能在WEB.CONFIG或者MACHINE.CONFIG里面设置
    或者高手们有更好的办法!!
      

  6.   

    Response.Write("<meta http-equiv='refresh' content='120, url=default.aspx'>");
      

  7.   

    >>一个网站也,不可能每个页面都这么设置把??1. write a javascript file, include in every file2. if  you are using ASP.NET, write a superclass which is derived from Page and output these scripts at Render time
      

  8.   

    thanks saucer(思归) :
    我用的是ASP.NET,就您说的两个方法,能不能给个简单的例子(或者是相关例子的连接)!
    非常感谢!!
      

  9.   

    UP
    思归不是只说了一种方法而已吗,
    把他说的JS放到前台页面不就行了吗。
      

  10.   

    设置session的timeout=2阿,然后再session_end事件里面写response.redirect("index.aspx")
      

  11.   

    NEW1981(埃艾斯皮点耐持) ,这样的话会话信息都被清空了
      

  12.   

    Public Sub delay(ByRef Interval As Double)
            Dim time As DateTime = DateTime.Now
            Dim Span As Double = Interval * 10000000 '因???是以100?秒??位。
            While ((DateTime.Now.Ticks - time.Ticks) < Span)
                Application.DoEvents()
            End While
        End Sub  加在共同类里面,每个页面用delay(秒)