ASP判是否登录代码

来源:百度知道 编辑:UC知道 时间:2024/06/03 23:16:41
<!--#include file="conn_xp/xp.asp"-->
<!--#include file="xpli.asp"-->
<%

if not (request.Cookies("shopxp")("username")="") then
response.Redirect "xpuser.asp"
response.End
end if
%>

为什么我使用这个代码,当未登录的没有任何提示,不会转向到xpuser.asp,登录了已经却转向xpuser.asp,与我想要的效果刚好相反,郁闷

<%
if not (request.Cookies("shopxp")("username")<>"") then
response.Redirect "xpuser.asp"
response.End
end if
%>
解释一下,意思是当cookie不等于空(就是已经登陆了)的相反状态--也就是未登陆了,就转向xpuser.asp

<!--#include file="conn_xp/xp.asp"-->
<!--#include file="xpli.asp"-->
<%

if request.Cookies("shopxp")("username")="" then
response.Redirect "xpuser.asp"
response.End
end if
%>

<%
if request.Cookies("shopxp")("username")="" then
response.Redirect "xpuser.asp"
response.End
end if
%>

那就去掉NOT嘛

up