ASP & Session Object
Learn and tutorial php using Http Server Session object , create session , read session , delete session..
ShotDev Focus:
- Create Session.
- Read Session.
- Delete Session.
Syntax
<% Session[.collection|property|method|event] %>
Example
asp_session1.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Session.TimeOut = 60 Session("SiteName") = "www.ShotDev.Com" Session("Name") = "Mr.Weerachai Nukitram" Response.write("Session Created<br><br>") Response.write("<a href=asp_session2.asp>Check Session</a>") %> </body> </html>
asp_session2.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Response.write "Site Name = " & Session("SiteName") & "<br>" Response.write "Name = " & Session("Name")& "<br><br>" Response.write("<a href=asp_session3.asp>Delete Session</a>") %> </body> </html>
asp_session3.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Session.Abandon() Response.write("Session Deleted<br><br>") Response.write("<a href=asp_session1.asp>Create Session</a><br>") Response.write("<a href=asp_session2.asp>Check Session</a><br>") %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_session1.asp
Screenshot
Property & Method
ASP Session.SessionID() - Session Object
ASP Session.TimeOut() - Session Object
ASP Session.Abandon() - Session Object
ASP Session.LCID() - Session Object
ASP Session.Contents() - Session Object
ASP Session.Contents.Remove() - Session Object
ASP Session.Contents.RemoveAll() - Session Object
ASP Session.StaticObjects() - Session Object
ASP Session.CodePage() - Session Object
ASP Session_OnStart() - Session Object
ASP Session_OnEnd() - Session Object
ASP Session & Object Value
ASP Session & Array