注册 登录
编程论坛 ASP技术论坛

退出为什么不能清空(附代码)

awke002 发布于 2008-09-08 11:15, 591 次点击
检验登陆成功是返回原页面,为什么我点了退出,没有清空登录状态反而还是显示在登陆状态当中
哪位大大能帮我看一下,是不是我的代码哪里写错了呢
、、

这是login.asp 登陆页面
<%
If Session("IsPassed") = true Then
%>
登陆成功! <% =Session("Name")%>,欢迎您的到来!

<div align="right"><a href="logout.asp">退出登陆</a></div>
<%else%>
<%
response.Write"<div align='left'> 用户名:<input name='Name'type='text'onblur='this.style.background='#FFF';' onfocus='this.style.background='#f4f4f4';'  size='8' maxlength='16' width='50' value='"
%>
<%
    '检查Cookies,如果存在帐号信息,则填写文本框
    'If (Request.Cookies("Name") <> EMPTY)  Then
        'Response.Write(Request.Cookies("Name"))
    'Else
        'Response.Write("")
    'End If
%>
<%
response.Write"' />"
response.Write" 密码:"
response.Write"<input name='passwd' type='password'  onblur='this.style.background='#FFF';' onfocus='this.style.background='#f4f4f4';' size='8' maxlength='16' width='50' value='"
%>
<%
    '检查Cookies,如果存在密码信息,则填写文本框
    'If (Request.Cookies("Password") <> EMPTY ) Then
        'Response.Write(Request.Cookies("Password"))
    'Else
        'Response.Write("")
    'End If
%>
<%
response.Write"' /> "

response.Write" <input name='btnSub' type='button' class='STYLE1' style='BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid'  value='登录'  onclick='SubmitForm()'/>"
response.Write"<input name='button' type='button' class='STYLE1' style='BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid' value='注册' onclick='window.location.href='landing_1.asp'' />"
response.Write" </div>"
%>
<%end if%>


这是退出页面 logout.asp
<%
    Session("Id") = ""
    Session("Name") = ""
    Session("IsPassed") = FALSE
    Session("IsAdmin") = FALSE
    Session("Class") = ""
    
    Response.Cookies("Name") = ""
    Response.Cookies("Password") = ""
    'Response.Cookies("RemMe") = ""
                
    Response.redirect(request.servervariables("http_referer"))
    Response.End
%>
5 回复
#2
awke0022008-09-08 14:47
高手进来帮忙解答一下下啦!
#3
tianyu1232008-09-08 19:26
这样试试
Response.redirect(request.servervariables("http_referer"))

改为:

Response.redirect("login.asp")
#4
awke0022008-09-09 08:54
你这样是指定 返回固定的页面可以行得通!

但是,我的意思就是说 ,用户在哪个页退出,还是返回哪一个页面!
#5
cbtxgt2008-09-09 09:27
[bo][un]tianyu123[/un] 在 2008-9-8 19:26 的发言:[/bo]

Response.redirect(request.servervariables("http_referer"))

改为:

Response.redirect("login.asp")

然后把Response.redirect(request.servervariables("http_referer"))
写在login.asp中试试
1