如何清空cookies后才退出
<%
Response.cookies("password")("username") = ""
session("password")=""
session("username")=""
session.abandon()
response.Redirect("index.asp")
%>
cookie在客户端,session是在服务器端
asp退出是清空:
下面的是代码,
session("MemName")
这是而面里面的 session name
当我退出后,显示出来的还是我之前的用户也就是信息没有清空掉,不知道该怎么办呀
VBScript code
function Login()
if session("MemName")="" or session("GroupID")="" or session("MemLogin")<>"Succeed" then
response.write "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0""> "&_
" <tr> "&_
" <td width=""28"" align=""right"" style=""padding:7px 7px 0px 0px; ""><img src=""images/info.gif"" alt="""" width=""14"" height=""14"" />"&_
"</td> "&_
" <td align=""left"" valign=""middle""> "&_
"<form name=""formLogin"" method=""post"" action=""MemberLogin.asp"">" &_
" 用户名: <input name=""LoginName"" type=""text"" class=""Login_text"" />" &_
" "&_
" 密 码: <input name=""LoginPassword"" type=""password"" class=""Login_text"" />" &_
" <input name=""GoLogin"" type=""image"" src=""Images/Login.gif"" width=""48"" height=""20"" align=""absmiddle"" /> " &_
" <a href=""MemberRegister.asp"" ><image src=""Images/Register.gif"" width=""48"" height=""20"" align=""absmiddle"" /></a>" &_
" <a href=""MemberGetPass.asp"">忘记密码了</a>" &_
" | " &_
" <a href=""ProductBuy.asp"">查看订购车</a>" &_
" </form>" &_
" </td> "&_
" </tr> "&_
"</table> "
else
response.write " " &_
"您好," &_
"<font style=""color:#1874cd;font-weight: bold;"">"&session("MemName")&"</font>" &_
" - "&MemGroup(session("GroupID"))&" " &_
"<a href=""MemberInfo.asp"">帐户管理</a>" &_
" | " &_
"<a href=""MemberLogin.asp?Action=Out"">退出登录</a>" &_
" | " &_
"<a href=""ProductBuy.asp"">订购车</a>"
end if
end function
这是登陆后的,用户的,菜单判断,当我用户退出后,还能看到,登陆之后才能看到的菜单,应该怎么办呀
VBScript code
function WebMenu()
dim rs,sql,MemName
Set Rs = Server.CreateObject("adodb.recordset")
Sql="select * from NwebCn_Members"
Rs.open Sql,conn,1,1
MemName=session("MemName")
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""MemberInfo.asp"">注册资料</a></div><br/>"
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""MemberMessage.asp"">我的留言</a></div><br/>"
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""MemberOrder.asp"">我的订单</a></div><br/>"
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""MemberTalent.asp"">我的应聘</a></div><br/>"
if rs("HtzgMem")=2 then
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""Consignment.asp"">发货管理</a></div><br/>"
end if
if rs("HtzgMem")=2 then
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""incept.asp"">维修收货</a></div><br/>"
end if
if rs("HtzgMem")=2 then
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""Stock.asp"">采购收货</a></div><br/>"
end if
if rs("HtzgMem")=1 then
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""backhander.asp"">销售拥金</a></div><br/>"
end if
response.write "<div style='border-style: dashed;border-width: 1px;border-left-width: 0px;border-right-width: 0px; border-top:0px; border-color:#A5BEDD; margin:3px 0px 0px 0px;'><img src='../../../images/1129288205.gif' border='0' width='19' height='17'> <a href=""MemberLogin.asp?Action=Out"">退出登录</a></div><br/>"
end function
清理session的时候,使用session.abandon 在同一个asp中,在session.abandon后session是还可以调用的,只有等整个asp运行完成后才真正无效. 先新建立一个退出注销页面的好,定义为logout.asp 代码 <% session("username")="" 清空用户名项目 session("userpassword")=""清空用户密码 session("username")=false session("userpassword")=false response.Cookies("username")=""清空cookie日志 response.Cookies("userpassword")="" response.Cookies("verifycode")="" response.Redirect("login.asp")返回主页面 response.End()写入结束 %> 在页面上简历超级连接,然后路径就连在这个logout.asp上面就可以了。