启动ASP会话

时间:2012-06-25 09:26:50

标签: asp-classic

我正在使用需要会话控制的ASP系统。使用ASP启动和检索会话值的语法是什么?

3 个答案:

答案 0 :(得分:2)

如果有人因不使用Google而大声喊叫,请先查看以下链接

http://www.w3schools.com/asp/asp_sessions.asp

答案 1 :(得分:2)

语法:

<% Session[.collection|property|method|event] %>

实施例

<% Option Explicit %>
<html>
<head>
<title>First Page</title>
</head>
<body>
<%
    Session.TimeOut  = 60
    Session("SiteName") = "www.example.com"
    Session("Name") = "Mr.Incredible"
    Response.write("Session Created<br><br>")
    Response.write("<a href=redirect.asp>Check Session</a>")
%>
</body>
</html>

重定向页面:

<% Option Explicit %>
<html>
<head>
<title>Redirect Page</title>
</head>
<body>
<%
    Response.write "Site Name = " & Session("SiteName") & "<br>"
    Response.write "Name = " & Session("Name")& "<br><br>"
%>
</body>
</html>

答案 2 :(得分:1)

      Session("name") = "something"   //storing value in session


      something = Session("name") //retrieving value from session