SlideShare une entreprise Scribd logo
1  sur  13
SERVER-SIDE STATE MANAGEMENT
OPTIONS
Server-side options for storing page information typically have higher security
than client-side options, but they can use more Web server resources, which
can lead to scalability issues when the size of the information store is large.
The following are the server-side state management options that ASP.NET
supports:
Session state
Application state
Session State:
 When a user connects to an ASP. Net website, a new session object is
created.
 When session state is turned on, a new session state object is created
for each new request.
 This session state object becomes part of the context and it is available
through the page.
Continue….
 Session state is generally used for storing application data like
inventory or supplier list, or a customer record or shopping cart. It
can also keep information about the user and his preference and keep
track of pending operations.
 Sessions are identified and tracked with a 120-bit SessionID, which is
passed from client to server and back as cookie or a modified URL.
The SessionID is globally unique and random.
 The session state object is created from the HttpSessionState class,
which defines a collection of session state items.
Session Properties
Properties Description
SessionID The unique session identifier
Item(name) The value of the session state item
with the specified name. This is the
default property of the
HttpSessionState class
Count The number of items in the session
state collection
TimeOut Gets and sets the amount of time, in
minutes, allowed between requests
before the session-state provider
terminates the session.
Methods
Methods Description
Add(name, value) Adds an item to the session state
collection
Clear Removes all the items from session
state collection
Remove(name) Removes the specified item from the
session state collection
RemoveAll Removes all keys and values from the
session-state collection.
RemoveAt Deletes an item at a specified index
from the session-state collection.
Example
 protected void btnSubmit_Click(object sender, EventArgs e)
{
 Session["FirstName"] = txtfName.Text;
 Session["LastName"] = txtlName.Text;
 Response.Redirect("Default2.aspx");
}
Advantage
• It is easy to implement and is just similar to using View State. 
• Accessing of data is very fast as it stores session data in memory 
object of the current application domain. 
• It ensures platform scalability and it works in the multi-process 
configuration. 
•  Also it ensures data durability, since the session state retains data 
even if ASP.NET work process restarts (in outproc session). 
Application State
 An  ASP.  Net  application  is  the  collection  of  all  web pages,  code  and 
other files within a single virtual directory on a web server. 
 When information is stored in application state, it is available to all 
the users.
 To provide for the use of application state, ASP. Net creates an
application state object for each application from the
HTTPApplicationState class and stores this object in server
memory. This object is represented by class file global. asax.
 Application  State  is  mostly  used  to  store  hit  counters  and  other 
statistical data, global application data like tax rate, discount rate etc 
and to keep track of users visiting the site.
Properties
Properties Description
Item(name) The value of the application state item
with the specified name. This is the
default property of the
HttpApplicationState class.
Count The number of items in the application
state collection.
Methods
Methods Description
Add(name, value)
Adds an item to the application state
collection .
Clear
Removes all the items from the
application state collection.
Remove(name)
Removes the specified item from the
application state collection.
RemoveAll
Removes all objects from an
HttpApplicationState collection.
RemoveAt
Removes an HttpApplicationState
object from a collection by index.
Lock()
Locks the application state collection
so only the current user can access it.
Unlock()
Unlocks the application state collection
so all the users can access it.
Events
 Application state data is generally maintained by writing handlers
for the events:
 Application_Start
 Application_End
 Application_Error
 Session_Start
 Session_End
Example
 Void Application_Start(object sender, EventArgs e)
 {
 Application["startMessage"] = "The application has started.";
 }
 Void Application_End(object sender, EventArgs e)
 {
 Application["endtMessage"] = "The application has ended.";
 }
Advantages
 Simple implementation
 Application scope Because application state is accessible to all pages in an
application, storing information in application state can mean keeping only a
single copy of the.

Contenu connexe

Tendances

State management
State managementState management
State management
Iblesoft
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
Madhuri Kavade
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
WO Community
 
Ssis2008 120710214348-phpapp02
Ssis2008 120710214348-phpapp02Ssis2008 120710214348-phpapp02
Ssis2008 120710214348-phpapp02
sumitkumar3201
 

Tendances (20)

State management
State managementState management
State management
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
State management
State managementState management
State management
 
ASP.NET Lecture 7
ASP.NET Lecture 7ASP.NET Lecture 7
ASP.NET Lecture 7
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Lecture12
Lecture12Lecture12
Lecture12
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Always encrypted overview
Always encrypted overviewAlways encrypted overview
Always encrypted overview
 
Database
DatabaseDatabase
Database
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
 
ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And Representation
 
Session and state management
Session and state managementSession and state management
Session and state management
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0
 
Aqua presentation
Aqua presentationAqua presentation
Aqua presentation
 
State management
State managementState management
State management
 
Sql server etl framework
Sql server etl frameworkSql server etl framework
Sql server etl framework
 
Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)Building nTier Applications with Entity Framework Services (Part 2)
Building nTier Applications with Entity Framework Services (Part 2)
 
Ssis2008 120710214348-phpapp02
Ssis2008 120710214348-phpapp02Ssis2008 120710214348-phpapp02
Ssis2008 120710214348-phpapp02
 
REST Basics
REST BasicsREST Basics
REST Basics
 

En vedette

6 month payday loans
6 month payday loans6 month payday loans
6 month payday loans
Adam Shaw
 
SWY and Albertsons
SWY and AlbertsonsSWY and Albertsons
SWY and Albertsons
Avital Reem
 
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-finalcgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
David Larcker
 
Kowshikaa consultancy overseas
Kowshikaa consultancy overseas Kowshikaa consultancy overseas
Kowshikaa consultancy overseas
Rajaram Ravindharan
 
Enlio Company presentation(6.10)
Enlio Company presentation(6.10)Enlio Company presentation(6.10)
Enlio Company presentation(6.10)
Arnaud Veere
 
Curriculum Vitae Madelaine
Curriculum Vitae MadelaineCurriculum Vitae Madelaine
Curriculum Vitae Madelaine
MADELAINE LAROYA
 
Sales skill presentation
Sales skill  presentationSales skill  presentation
Sales skill presentation
Rajaram Ravindharan
 

En vedette (20)

доклад маційчука п.в. 2015
доклад маційчука п.в. 2015доклад маційчука п.в. 2015
доклад маційчука п.в. 2015
 
6 month payday loans
6 month payday loans6 month payday loans
6 month payday loans
 
வெற்றி
வெற்றிவெற்றி
வெற்றி
 
SWY and Albertsons
SWY and AlbertsonsSWY and Albertsons
SWY and Albertsons
 
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-finalcgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
cgri-stanford-survey-ceos-and-directors-ceo-pay-2016-final
 
9tex BD Profile
9tex BD Profile9tex BD Profile
9tex BD Profile
 
Sandbox Conference Presentation
Sandbox Conference PresentationSandbox Conference Presentation
Sandbox Conference Presentation
 
Be social - Le logiche dei social network
Be social - Le logiche dei social networkBe social - Le logiche dei social network
Be social - Le logiche dei social network
 
Kowshikaa consultancy overseas
Kowshikaa consultancy overseas Kowshikaa consultancy overseas
Kowshikaa consultancy overseas
 
contextual study-part 1
contextual study-part 1contextual study-part 1
contextual study-part 1
 
Is accounting software hurting your business?
Is accounting software hurting your business?Is accounting software hurting your business?
Is accounting software hurting your business?
 
Dados de mercado Novembro 2016
Dados de mercado Novembro 2016Dados de mercado Novembro 2016
Dados de mercado Novembro 2016
 
Enlio Company presentation(6.10)
Enlio Company presentation(6.10)Enlio Company presentation(6.10)
Enlio Company presentation(6.10)
 
Curriculum Vitae Madelaine
Curriculum Vitae MadelaineCurriculum Vitae Madelaine
Curriculum Vitae Madelaine
 
Sales skill presentation
Sales skill  presentationSales skill  presentation
Sales skill presentation
 
Ingeniería Mecánica
Ingeniería MecánicaIngeniería Mecánica
Ingeniería Mecánica
 
வெற்றி
வெற்றிவெற்றி
வெற்றி
 
resume
resumeresume
resume
 
IT Solutions zorgt voor uw groei!
IT Solutions zorgt voor uw groei!IT Solutions zorgt voor uw groei!
IT Solutions zorgt voor uw groei!
 
Global Pack Hungary Presentation ENG - Tape & Go
Global Pack Hungary Presentation ENG  - Tape & GoGlobal Pack Hungary Presentation ENG  - Tape & Go
Global Pack Hungary Presentation ENG - Tape & Go
 

Similaire à Session viii(state mngtserver)

05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
Mani Chaubey
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
Niit Care
 
Msdn Workflow Services And Windows Server App Fabric
Msdn Workflow Services And Windows Server App FabricMsdn Workflow Services And Windows Server App Fabric
Msdn Workflow Services And Windows Server App Fabric
Juan Pablo
 
ASP.Net Presentation Part3
ASP.Net Presentation Part3ASP.Net Presentation Part3
ASP.Net Presentation Part3
Neeraj Mathur
 
Ch 04 asp.net application
Ch 04 asp.net application Ch 04 asp.net application
Ch 04 asp.net application
Madhuri Kavade
 

Similaire à Session viii(state mngtserver) (20)

StateManagement in ASP.Net.ppt
StateManagement in ASP.Net.pptStateManagement in ASP.Net.ppt
StateManagement in ASP.Net.ppt
 
State management in ASP.NET
State management in ASP.NETState management in ASP.NET
State management in ASP.NET
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2
 
Asp.net
Asp.netAsp.net
Asp.net
 
Managing states
Managing statesManaging states
Managing states
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
Chapter 8 part2
Chapter 8   part2Chapter 8   part2
Chapter 8 part2
 
ASP session object
ASP session objectASP session object
ASP session object
 
IEEE KUET SPAC presentation
IEEE KUET SPAC  presentationIEEE KUET SPAC  presentation
IEEE KUET SPAC presentation
 
ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
 
State management
State managementState management
State management
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
Msdn Workflow Services And Windows Server App Fabric
Msdn Workflow Services And Windows Server App FabricMsdn Workflow Services And Windows Server App Fabric
Msdn Workflow Services And Windows Server App Fabric
 
ASP.Net Presentation Part3
ASP.Net Presentation Part3ASP.Net Presentation Part3
ASP.Net Presentation Part3
 
Ch 04 asp.net application
Ch 04 asp.net application Ch 04 asp.net application
Ch 04 asp.net application
 

Plus de Shrijan Tiwari (12)

ASPX Session xi(page lifecycle)
ASPX Session xi(page lifecycle)ASPX Session xi(page lifecycle)
ASPX Session xi(page lifecycle)
 
Session x(ado.net)
Session x(ado.net)Session x(ado.net)
Session x(ado.net)
 
Session viii(state mngtclient)
Session viii(state mngtclient)Session viii(state mngtclient)
Session viii(state mngtclient)
 
Session vii(java scriptbasics)
Session vii(java scriptbasics)Session vii(java scriptbasics)
Session vii(java scriptbasics)
 
Session vi(user control)
Session vi(user control)Session vi(user control)
Session vi(user control)
 
Session v(css)
Session v(css)Session v(css)
Session v(css)
 
Session ix(database)
Session ix(database)Session ix(database)
Session ix(database)
 
Session iv(master pages)
Session iv(master pages)Session iv(master pages)
Session iv(master pages)
 
Session iii(server controls)
Session iii(server controls)Session iii(server controls)
Session iii(server controls)
 
Session ii(html)
Session ii(html)Session ii(html)
Session ii(html)
 
Session i(introduction)
Session i(introduction)Session i(introduction)
Session i(introduction)
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 

Dernier

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Session viii(state mngtserver)

  • 1. SERVER-SIDE STATE MANAGEMENT OPTIONS Server-side options for storing page information typically have higher security than client-side options, but they can use more Web server resources, which can lead to scalability issues when the size of the information store is large. The following are the server-side state management options that ASP.NET supports: Session state Application state
  • 2. Session State:  When a user connects to an ASP. Net website, a new session object is created.  When session state is turned on, a new session state object is created for each new request.  This session state object becomes part of the context and it is available through the page.
  • 3. Continue….  Session state is generally used for storing application data like inventory or supplier list, or a customer record or shopping cart. It can also keep information about the user and his preference and keep track of pending operations.  Sessions are identified and tracked with a 120-bit SessionID, which is passed from client to server and back as cookie or a modified URL. The SessionID is globally unique and random.  The session state object is created from the HttpSessionState class, which defines a collection of session state items.
  • 4. Session Properties Properties Description SessionID The unique session identifier Item(name) The value of the session state item with the specified name. This is the default property of the HttpSessionState class Count The number of items in the session state collection TimeOut Gets and sets the amount of time, in minutes, allowed between requests before the session-state provider terminates the session.
  • 5. Methods Methods Description Add(name, value) Adds an item to the session state collection Clear Removes all the items from session state collection Remove(name) Removes the specified item from the session state collection RemoveAll Removes all keys and values from the session-state collection. RemoveAt Deletes an item at a specified index from the session-state collection.
  • 6. Example  protected void btnSubmit_Click(object sender, EventArgs e) {  Session["FirstName"] = txtfName.Text;  Session["LastName"] = txtlName.Text;  Response.Redirect("Default2.aspx"); }
  • 7. Advantage • It is easy to implement and is just similar to using View State.  • Accessing of data is very fast as it stores session data in memory  object of the current application domain.  • It ensures platform scalability and it works in the multi-process  configuration.  •  Also it ensures data durability, since the session state retains data  even if ASP.NET work process restarts (in outproc session). 
  • 8. Application State  An  ASP.  Net  application  is  the  collection  of  all  web pages,  code  and  other files within a single virtual directory on a web server.   When information is stored in application state, it is available to all  the users.  To provide for the use of application state, ASP. Net creates an application state object for each application from the HTTPApplicationState class and stores this object in server memory. This object is represented by class file global. asax.  Application  State  is  mostly  used  to  store  hit  counters  and  other  statistical data, global application data like tax rate, discount rate etc  and to keep track of users visiting the site.
  • 9. Properties Properties Description Item(name) The value of the application state item with the specified name. This is the default property of the HttpApplicationState class. Count The number of items in the application state collection.
  • 10. Methods Methods Description Add(name, value) Adds an item to the application state collection . Clear Removes all the items from the application state collection. Remove(name) Removes the specified item from the application state collection. RemoveAll Removes all objects from an HttpApplicationState collection. RemoveAt Removes an HttpApplicationState object from a collection by index. Lock() Locks the application state collection so only the current user can access it. Unlock() Unlocks the application state collection so all the users can access it.
  • 11. Events  Application state data is generally maintained by writing handlers for the events:  Application_Start  Application_End  Application_Error  Session_Start  Session_End
  • 12. Example  Void Application_Start(object sender, EventArgs e)  {  Application["startMessage"] = "The application has started.";  }  Void Application_End(object sender, EventArgs e)  {  Application["endtMessage"] = "The application has ended.";  }
  • 13. Advantages  Simple implementation  Application scope Because application state is accessible to all pages in an application, storing information in application state can mean keeping only a single copy of the.