Awt session object
Upcoming SlideShare
Loading in...5

Awt session object



About ASP Session Object

About ASP Session Object



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Awt session object Awt session object Presentation Transcript

  • ASP Session Object Presented By: Chandan K. Padalkar
  • Session  A Session is the time for which a particular user interacts with a web application.  Sessions helps to preserve data across successive accesses.  Sessions serve as a way to transport and maintain user data in web pages, such as forums, or e-commerce websites.
  • Session Object  When you are working with an application on your computer, you open it, do some changes and then you close it. This is much like a Session. The computer knows who you are. It knows when you open the application and when you close it.  on the internet there is one problem: the web server does not know who you are and what you do, because the HTTP address doesn't maintain state.  ASP solves this problem by creating a unique cookie for each user. The cookie is sent to the user's computer and it contains information that identifies the user. This interface is called the Session object.
  •  Session objects give us the power to preserve user preferences and other user information when browsing a web application.  The Session object is user specific.  Variables stored in a Session object hold information about one single user, and are available to all pages in one application. Common information stored in session variables are name, id, and preferences.  Practical e.g. is the case of an e-commerce website where the visitor browses through many pages and wants to keep track of the products ordered.
  • Methods Methods Description Abandon destroy all objects stored in a Session object and releases their resources. If the Abandon method is not explicitly called, the web server will maintain all session information until the session times out. Contents.Remove removes the specified item from the Session object Contents collection. Contents.RemoveAll removes all the items from the Session object Contents collection.
  • Events Events Description Session_OnStart The Application_OnStart event occurs when a new session starts, before the page that the user requests is executed. Session_OnEnd The Session_OnEnd event occurs when the user's session is abandoned or times out.
  • When Session starts?  A new user requests an ASP file, and the Global.asa file includes a Session_OnStart procedure  A value is stored in a Session variable  A user requests an ASP file, and the Global.asa file uses the <object> tag to instantiate an object with session scope
  • When Session Ends?  A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes.  If you want to set a timeout interval that is shorter or longer than the default, use the Timeout property.
  • Session Timeout <% response.write("Default Timeout is: " & Session.Timeout & " minutes.")  Session.Timeout=30  response.write("Timeout is now: " & Session.Timeout & " minutes.") %>  O/P: Default Timeout is: 20 minutes. Timeout is now: 30 minutes. 
  • Problem with Session Object  The Session object is based on using cookies, so if cookies are not permitted or disabled on the client browser (because of firewall issues, browser incompatibility, or desktop/network security concerns), the Session object is rendered useless.