SlideShare a Scribd company logo
1 of 29
Download to read offline
Welcome to my ppt
PRESENTATION ON STATE MANAGEMENT
IN ASP.NET
Q. WHAT IS STATE MANAGEMENT ?
State Management is very important feature in Asp.net .
State Management is a process by which state and page
information is maintained over multiple requests for same or
different pages.
State management maintains and stores the information of any
user till the end of the user session .
As HTTP is a stateless protocol ,server does not store any
information once the response is sent back to client based on his
request.
Web server does not have any idea about the requests.
When user submits request again, the server treats it as a new
user.
E.g. Online registration form.
So, to retain the values of the controls
we use state management techniques.
They are classified into the following
two categories :-
❖ Client side state management -
• Which Utilizes Client Resources
• Ways:View state , Control State,
Hidden Field State, Cookies,
Query Strings, Cache.
❖ Server side state management -
• Which Utilizes Server Resources
• Ways: Session State, Application
State
CLIENT SIDE STATE
MANAGEMENT
VIEW STATE
OR
Q. SIGNIFICANT OF VIEW STATE IN ASP.NET
Features of view state –
o Retains the value of the control after post-back without using a session.
o Stores the value of pages and control properties defined in the page.
o Creates a custom View State Provider that lets us store view state information in a
SQL server database or in another data store.
Advantages -
o Easy to Implement.
o No server resources are required.The View State is contained in a structure within the page
load.
o Enhanced security features: It can be encoded and compressed or Unicode implementation.
Disadvantages -
o Security risk
o Performance Consideration
o Device limitation
Example :
Q. WHAT IS QUERY STRING ?
o A Query String contains the information that is sent to server with URL.
o The URL part which comes after the ? Symbol is called QueryString.
o It has two parts , a key and a value. Like for E.G.- ?query=foo , here query is the
key and foo Is its value.
Advantages -
o It is very lightweight and will not consume any server resources.
o It is very easy to use and it is the most efficient state management
technique.
o Simple implementation.
Disadvantages -
o We can pass information only as a string.
o URL length has limitations. So we can’t send much information
through URL.
o Information passed is clearly visible to everyone and can be easily
altered/Potential Security Risk.
o Limited capacity
HIDDEN FIELDS
COOKIES
OR
Q. ROLE OF COOKIES IN ASP.NET
ASP.NET Cookie is a small bit of text that is used to store
user-specific information.
This information can be read by the web application whenever
user visits the site.
When a user requests for a web page, web server sends not just a
page, but also a cookie containing the date and time.
TYPES OF COOKIES
THERE ARE TWO TYPES OF COOKIES –
•Persist cookies
•Non-Persist cookies
❑ Persist Cookie
When cookies are saved within the browser’s temporary folder on the
client’s machine, such cookies are said to be persisted, because
information saved can be retrieved at any time, so long the cookies’
expiration date has not elapsed.
❑ Non-Persist
Cookies
Also known as session or in-memory cookies, these are only useable while
the browser is open.They are not saved locally on the client’s machine.
Advantages of Cookies -
o Its clear text so user can able to read it
o We can store user preference information on the client machine.
o Its easy way to maintain.
o Fast accessing.
Disadvantages of Cookies -
o If user clears cookie information we can't get it back.
o No security
o Each request will have cookie information with page.
protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie Username = new
HttpCookie("UserName","WELCOME");
Username.Expires=DateTime.Now.AddYears(1);
Response.Cookies.Add(Username);
}
Q.Write a program to create a new cookie with the name
“Username” and add it to the HTTP Response object on the click of
a button. Set the expiry date of the cookie to One year from Now.
❖ Code
SERVER SIDE STATE
MANAGEMENT
❖ SESSION STATE
• Stored in the server’s memory and value can be accessed across
page requests.
Advantages –
o Cookieless support
o Data persistence
Disadvantages –
o Performance Consideration
❖ APPLICATION STATE
o It is used to store global application specific information.
o Automatically created when a first request is made to a web application.
o Storing Application state in the server’s memory is better than storing the
information in the database.
o It is server side state management mechanism.
o The application state is used same as session, but the difference is, the
session state is specific for a single user; where as an application state is
common for all users.
Advantages
o Application scope
o Simple implementation
Disadvantages
o Requires server resources
o Limited durability of data (server cash or shutdown)
EXAMPLE -
HERE WE ARE GOING TO CALCULATE HOW MANY TIMES A
GIVEN PAGE HAS BEEN VISITED BY VARIOUS CLIENTS.
 state management asp.net
 state management asp.net
 state management asp.net

More Related Content

Similar to state management asp.net

Job portal at jiit 2013-14
Job portal at jiit 2013-14Job portal at jiit 2013-14
Job portal at jiit 2013-14kbabhishek4
 
Documentation
DocumentationDocumentation
DocumentationKalyan A
 
ASP.NET State management
ASP.NET State managementASP.NET State management
ASP.NET State managementShivanand Arur
 
Cache Security- Adding Security to Non-Secure Applications
Cache Security- Adding Security to Non-Secure ApplicationsCache Security- Adding Security to Non-Secure Applications
Cache Security- Adding Security to Non-Secure ApplicationsInterSystems Corporation
 
Lecture32-Web-based-testing-II.pptx
Lecture32-Web-based-testing-II.pptxLecture32-Web-based-testing-II.pptx
Lecture32-Web-based-testing-II.pptxBalkrishanpatidar
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...WebStackAcademy
 
E-Business And Technology Essay
E-Business And Technology EssayE-Business And Technology Essay
E-Business And Technology EssayPamela Wright
 
State management
State managementState management
State managementIblesoft
 

Similar to state management asp.net (20)

Job portal at jiit 2013-14
Job portal at jiit 2013-14Job portal at jiit 2013-14
Job portal at jiit 2013-14
 
Asp.net
Asp.netAsp.net
Asp.net
 
State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NET
 
Documentation
DocumentationDocumentation
Documentation
 
ASP.NET State management
ASP.NET State managementASP.NET State management
ASP.NET State management
 
28791456 web-testing
28791456 web-testing28791456 web-testing
28791456 web-testing
 
OWASP Top 10 Proactive Control 2016 (C5-C10)
OWASP Top 10 Proactive Control 2016 (C5-C10)OWASP Top 10 Proactive Control 2016 (C5-C10)
OWASP Top 10 Proactive Control 2016 (C5-C10)
 
Cache Security- Adding Security to Non-Secure Applications
Cache Security- Adding Security to Non-Secure ApplicationsCache Security- Adding Security to Non-Secure Applications
Cache Security- Adding Security to Non-Secure Applications
 
Lecture32-Web-based-testing-II.pptx
Lecture32-Web-based-testing-II.pptxLecture32-Web-based-testing-II.pptx
Lecture32-Web-based-testing-II.pptx
 
Online Test Engine
Online  Test EngineOnline  Test Engine
Online Test Engine
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
E-Examination
E-ExaminationE-Examination
E-Examination
 
Job portal
Job portalJob portal
Job portal
 
E-Business And Technology Essay
E-Business And Technology EssayE-Business And Technology Essay
E-Business And Technology Essay
 
locker presentation (1)
locker presentation (1)locker presentation (1)
locker presentation (1)
 
Browser Based Performance Testing and Tuning
Browser Based Performance Testing and TuningBrowser Based Performance Testing and Tuning
Browser Based Performance Testing and Tuning
 
State management
State managementState management
State management
 
Ch7-Computer Security
Ch7-Computer SecurityCh7-Computer Security
Ch7-Computer Security
 
load_testing.ppt.pptx
load_testing.ppt.pptxload_testing.ppt.pptx
load_testing.ppt.pptx
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 

Recently uploaded

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
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 ClassroomPooky Knightsmith
 
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.pdfDr Vijay Vishwakarma
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
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
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
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).pptxmarlenawright1
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
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_...Pooja Bhuva
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
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
 
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
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
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...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
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
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.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_...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

state management asp.net

  • 2. PRESENTATION ON STATE MANAGEMENT IN ASP.NET
  • 3. Q. WHAT IS STATE MANAGEMENT ? State Management is very important feature in Asp.net . State Management is a process by which state and page information is maintained over multiple requests for same or different pages. State management maintains and stores the information of any user till the end of the user session . As HTTP is a stateless protocol ,server does not store any information once the response is sent back to client based on his request. Web server does not have any idea about the requests. When user submits request again, the server treats it as a new user. E.g. Online registration form.
  • 4. So, to retain the values of the controls we use state management techniques. They are classified into the following two categories :- ❖ Client side state management - • Which Utilizes Client Resources • Ways:View state , Control State, Hidden Field State, Cookies, Query Strings, Cache. ❖ Server side state management - • Which Utilizes Server Resources • Ways: Session State, Application State
  • 6. VIEW STATE OR Q. SIGNIFICANT OF VIEW STATE IN ASP.NET
  • 7. Features of view state – o Retains the value of the control after post-back without using a session. o Stores the value of pages and control properties defined in the page. o Creates a custom View State Provider that lets us store view state information in a SQL server database or in another data store. Advantages - o Easy to Implement. o No server resources are required.The View State is contained in a structure within the page load. o Enhanced security features: It can be encoded and compressed or Unicode implementation. Disadvantages - o Security risk o Performance Consideration o Device limitation
  • 9.
  • 10. Q. WHAT IS QUERY STRING ? o A Query String contains the information that is sent to server with URL. o The URL part which comes after the ? Symbol is called QueryString. o It has two parts , a key and a value. Like for E.G.- ?query=foo , here query is the key and foo Is its value.
  • 11. Advantages - o It is very lightweight and will not consume any server resources. o It is very easy to use and it is the most efficient state management technique. o Simple implementation. Disadvantages - o We can pass information only as a string. o URL length has limitations. So we can’t send much information through URL. o Information passed is clearly visible to everyone and can be easily altered/Potential Security Risk. o Limited capacity
  • 12.
  • 13.
  • 14.
  • 16. COOKIES OR Q. ROLE OF COOKIES IN ASP.NET ASP.NET Cookie is a small bit of text that is used to store user-specific information. This information can be read by the web application whenever user visits the site. When a user requests for a web page, web server sends not just a page, but also a cookie containing the date and time.
  • 17. TYPES OF COOKIES THERE ARE TWO TYPES OF COOKIES – •Persist cookies •Non-Persist cookies
  • 18. ❑ Persist Cookie When cookies are saved within the browser’s temporary folder on the client’s machine, such cookies are said to be persisted, because information saved can be retrieved at any time, so long the cookies’ expiration date has not elapsed. ❑ Non-Persist Cookies Also known as session or in-memory cookies, these are only useable while the browser is open.They are not saved locally on the client’s machine.
  • 19. Advantages of Cookies - o Its clear text so user can able to read it o We can store user preference information on the client machine. o Its easy way to maintain. o Fast accessing. Disadvantages of Cookies - o If user clears cookie information we can't get it back. o No security o Each request will have cookie information with page.
  • 20. protected void Button1_Click(object sender, EventArgs e) { HttpCookie Username = new HttpCookie("UserName","WELCOME"); Username.Expires=DateTime.Now.AddYears(1); Response.Cookies.Add(Username); } Q.Write a program to create a new cookie with the name “Username” and add it to the HTTP Response object on the click of a button. Set the expiry date of the cookie to One year from Now. ❖ Code
  • 22. ❖ SESSION STATE • Stored in the server’s memory and value can be accessed across page requests.
  • 23. Advantages – o Cookieless support o Data persistence Disadvantages – o Performance Consideration
  • 24. ❖ APPLICATION STATE o It is used to store global application specific information. o Automatically created when a first request is made to a web application. o Storing Application state in the server’s memory is better than storing the information in the database. o It is server side state management mechanism. o The application state is used same as session, but the difference is, the session state is specific for a single user; where as an application state is common for all users.
  • 25. Advantages o Application scope o Simple implementation Disadvantages o Requires server resources o Limited durability of data (server cash or shutdown)
  • 26. EXAMPLE - HERE WE ARE GOING TO CALCULATE HOW MANY TIMES A GIVEN PAGE HAS BEEN VISITED BY VARIOUS CLIENTS.