play视频手机版:asp中关于session的问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/05 09:34:26
set rs=conn.Execute("select username from admin where username='" & username1 & "' and password='" & password1 & "'")
if rs.eof then
rs.close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "error.asp"
else
rs.close
set rs=nothing
conn.Close
set conn=nothing
Session("User_ID")=rs("userid")
Session("LogOn")="ok"
Response.Redirect "index.asp"
end if
End if
=======
程序出错,问题在于加了:报错!
Session("User_ID")=rs("userid")
Session("LogOn")="ok"
去掉这两句就通过了。纳闷中,是不是服务器不允许设置session,还是怎么一回事,啊有高手告之。
=======
怎么样做才能使服务器允许使用session?

session对象用来载特定客的信息,客户从一个页面跳转到另一个页面,该session信息仍然存在,客户在这个网站的任何一个页面都可以存取session信息.

aplliction对象是让所有客户一起使用的对象,通过这个对象,所有客户都可以存取同一个applliction对象.(聊天室的实现)

cookies俗称小甜饼,可以在客户端长期保存信息.有两种形式:会话COOKIES和永久COOKIES,ASP利用RESPONSE对象的COOKIES方法设置COOKIES, 利用REQUEST对象的COOKIES获取方法获取COOKIES的值.

lolooo手打原创,如要引用,请注明参考`~~~~~

set rs=conn.Execute("select username from admin where username='" & username1 & "' and password='" & password1 & "'")
if rs.eof then
rs.close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "error.asp"
else
rs.close
set rs=nothing
conn.Close
set conn=nothing
Session("User_ID")=rs("userid")
Session("LogOn")="ok"
Response.Redirect "index.asp"
end if
End if

你看你都把rs关了 那你怎么取rs("userid")
把那两句话放到else后面就可以了