asp代码 网页注销问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 03:31:31
<script>
<%tml=request("tml")
if tml="" then%>
if (window.confirm("确认要注销吗")){
location.href="exit.asp?tml=exit";
}
else history.back(-1);
<%else
session("UserName")=""
session("admin")=""
response.Cookies("tml")("u")=""
response.Cookies("tml").Expires=Date-1
session.Abandon()%>
alert("注销成功!您已成功退出!");
location.href="index.asp";
<%end if%>
</script>

以上代码写玩,放到网站里,点注销.怎么用户还在显示.求助.没发注销
xxq8210 你那段代码放进去不行.我首页代码是
<%if Request.ServerVariables("REMOTE_ADDR")="127.0.0.1" then
session("UserName")=""
end if

if session("UserName")<>"" then%>
<%=session("UserName")%>,已登录 | <A
class=menu href="<

--------------exit.asp-----------------

<%

tml=request("tml")

if tml="exit" then
session("UserName")=""
session("admin")=""
response.Cookies("tml")("u")=""
response.Cookies("tml").Expires=Date-1
session.Abandon()
response.write "<script>alert('注销成功!您已成功退出!');document.location.href = 'index.asp';</script>"

else
response.write "<script>window.history.back(-1);</script>"
end
%>

---------------CurrentPage-------------------------------

<script>
if (window.confirm("确认要注销吗"))
{
location.href="exit.asp?tml=exit";
}
</script>

看起来好像是页面缓存的问题,已经注销了,只是浏览器显示的是它之前缓存的页面,在index.asp加入如下的代码试试:

'避免浏览器缓存
Response.Buffer = T