藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年8月25日 8:28

能說一下session怎麼用?

能說一下session怎麼用?

HTTP是無狀態協議,無法判斷用戶會話的狀態。Session起到了這個作用,相當於記錄了用戶的會話。

列:(判斷管理員用戶是否登陸)

<%
If password = rs("password") and user = rs("user") Then
    session("a")="asdf"
Else
    Response.Write "Error! Invild password or user!"
    Response.End
End If
%>
<a href="abc.asp?action=xxxxx">查看留言</a>
<% If session("a")="asdf" Then%>
<a href="abc.asp?action=del&id=1234">刪除留言</a>
<a href="abc.asp?action=edit&id=1234">編輯留言</a>
<%End If%>

說簡單點就是確認登錄者身份用的。




session 的用處何止這些...




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com