我想实现session过期后自动将页面跳转到登录窗口,代码如下:
if session is nothing then
Response.Redirect("login.aspx")
End if但是过期后没有任何反应,请问该怎么写?
if session is nothing then
Response.Redirect("login.aspx")
End if但是过期后没有任何反应,请问该怎么写?
调试欢乐多
session["flag"] != null
Response.Redirect("login.aspx")
End if
在page_load里,添加下面语句:
if session("UserType") is nothing then
Response.Redirect("\login.aspx")————login.aspx和当前页面在不同文件夹里
End if然后用下面语句定时自动刷新
<meta http-equiv="refresh" content="1200; url=当前页面.aspx">
因为session20分钟过期,所以自动刷新时间定为1200s
可以完成页面跳转,但是login.aspx没有跳出当前页面的框架,请问怎么能跳出来呢?
if session("UserType") is nothing then
Response.Write("<script language=javascript>
top.location.href='/login.aspx';<"&"/"&"script>")
End if