I am working on a system using ASP that requires session control. What is the syntax for starting and retrieving a session value using ASP?
Before someone shouts at your for not using Google first check out the below link
http://www.w3schools.com/asp/asp_sessions.asp
Syntax:
<% Session[.collection|property|method|event] %>
Example
<% 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>
Redirect Page:
<% 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With