SlideShare une entreprise Scribd logo
1  sur  10
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.

Contenu connexe

Tendances

Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
ShingalaKrupa
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
Aarti P
 

Tendances (20)

HTML Forms
HTML FormsHTML Forms
HTML Forms
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
 
Html JavaScript and CSS
Html JavaScript and CSSHtml JavaScript and CSS
Html JavaScript and CSS
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
Css
CssCss
Css
 
What is JavaScript? Edureka
What is JavaScript? EdurekaWhat is JavaScript? Edureka
What is JavaScript? Edureka
 
Bootstrap PPT Part - 2
Bootstrap PPT Part - 2Bootstrap PPT Part - 2
Bootstrap PPT Part - 2
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Web controls
Web controlsWeb controls
Web controls
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
 
Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4
 
HTML/HTML5
HTML/HTML5HTML/HTML5
HTML/HTML5
 
css.ppt
css.pptcss.ppt
css.ppt
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 

Similaire à ASP session object

Programming web application
Programming web applicationProgramming web application
Programming web application
aspnet123
 

Similaire à ASP session object (20)

Session viii(state mngtserver)
Session viii(state mngtserver)Session viii(state mngtserver)
Session viii(state mngtserver)
 
Asp.net
Asp.netAsp.net
Asp.net
 
Session and state management
Session and state managementSession and state management
Session and state management
 
IEEE KUET SPAC presentation
IEEE KUET SPAC  presentationIEEE KUET SPAC  presentation
IEEE KUET SPAC presentation
 
Jsp session tracking
Jsp   session trackingJsp   session tracking
Jsp session tracking
 
NET_Training.pptx
NET_Training.pptxNET_Training.pptx
NET_Training.pptx
 
State management in asp
State management in aspState management in asp
State management in asp
 
StateManagement in ASP.Net.ppt
StateManagement in ASP.Net.pptStateManagement in ASP.Net.ppt
StateManagement in ASP.Net.ppt
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
Lecture8
Lecture8Lecture8
Lecture8
 
State management
State managementState management
State management
 
Asp objects
Asp objectsAsp objects
Asp objects
 
Asp.net+interview+questions+and+answers
Asp.net+interview+questions+and+answersAsp.net+interview+questions+and+answers
Asp.net+interview+questions+and+answers
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
 
lecture 13.pptx
lecture 13.pptxlecture 13.pptx
lecture 13.pptx
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
Programming web application
Programming web applicationProgramming web application
Programming web application
 
Php sessions
Php sessionsPhp sessions
Php sessions
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 

ASP session object

  • 1. ASP Session Object Presented By: Chandan K. Padalkar
  • 2. 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.
  • 3. 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.
  • 4.  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.
  • 5. 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.
  • 6. 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.
  • 7. 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
  • 8. 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.
  • 9. 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. 
  • 10. 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.