if not me.ispostback
me.sess("aa") = nothing
end if我想要这个page_load里面的程序延迟2秒再执行,应该怎么写呢

解决方案 »

  1.   

    System.Threading.Thread.Sleep(2000);
    ____________________________
    (2004年12月28日 11时07分46秒)
      

  2.   

    System.Threading.Thread.CurrentThread.Join(2000);
      

  3.   

    时间是延迟了,但是还是不能达到我要的效果
     If Not Me.IsPostBack Then
                Me.Image1.Visible = True
                System.Threading.Thread.Sleep(12000)
                Me.Session("aa") = Nothing
                Me.Response.Redirect("/")
            End If我想先显示图片出来,然后再等待12秒,然后注销session
    我这个还是不行
      

  4.   

    因为你的Me.Image1.Visiable=True的语句还只是在Server端执行,还没有把结果页面返回到客户端。所以你的Sleep(12000),只不过是在生成完部分页面后,停了12秒,然后再给aa赋值。再添加一个页面吧,这个页面停留12000,然后再postback,取消Session。
    或者添加一个线程,线路12秒后,自动给aa赋值。但线程没办法再控制前端的页面了。
      

  5.   

    做个转换页跳到另一个页。写上
    <Meta HTTP-EQUIV="refresh" content="2; url=OhterPage.aspx">