关于判断session变量问题

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:43:32
<%
'判断纪录是否为空
if session("user_id")="" then
response.redirect"index.asp"
response.end
end if
%>为什么我的页面总是判断我session("user_name")为空的,在转到这页的时候我已经把user_id初次化了...
对不起,我的问题打错了,是我的页面总是判断我session("user_id)为空的,在转到这页的时候我已经把user_id初次化了

if session("user_id")&"a"="a" then

改成这样试试看~~

如果不行再测试下session值是否对了
response.write session("user_id")
response.end

你的代码是判断SESSION中 user_id是否为空,不是user_name。

如果你没有定义过user_name,那它永远是空的。