C# cookieless session id and application state

M
Malav PatelStudent at G.H.PATEL COLLEGE OF ENGG. & TECH. , V. V. NAGAR 011
G. H. PATEL COLLEGE OF
ENGINEERING AND TECHNOLOGY
2160711 DOT NET TECHNOLOGY
ACADEMIC YEAR : 2018-19 (EVEN) (6th sem)
Group members :
JUSTIN PATEL 160110107039
MALAV PATEL 160110107040
Guided By,
Prof. Khyati Mehta
Presentation
Using Cookieless Session IDs
Application State
State Management Basic’s
• A Web Form / Page follows Stateless Model ie. The Server does not have
any information about who is requesting the page.
• Therefore to keep the Website more interactive we need to remember some
variables like username, items in cart for a shopping website, if the website
had the user has logged in once then we don’t have to make him login again
and again.
• To make the Website Stateful ASP.NET Framework provides various ways to
preserve the state of website.
Sate Management Methods
• Client Side Methods –
• ViewState
• Hidden Fields
• Query Strings
• Cookies
• Control State
• Server Side Methods
• Application State
• Session State
To Main Point – Session’s
• Session is Server side method for State Management.
• Session use Session Id to keep track of the user.
• Session Id are random strings generated by ASP.NET when the page is request by a
form submission or first entry.
• Session is defined in web.config to remember for 20 min by default.
• Session’s use Cookies to store the information of Session Id , But …
• why use Cookies to store the session id what if cookies are disabled on user side.
How To Cookie-less Session
• In web.config file enable Cookieless to true to enable Cookie-less Sessions.
• <sessionState mode="InProc" cookieless="true"></sessionState>
• With is being done we will notice some funky change in our site URL.
• Default  localhost:27858/WebForm1.aspx
• Cookieless Enabled 
http://localhost:60829/(S(f2lgip3ryfnlm4kpyfico03y))/WebForm1.aspx
• This String is the Session Id which we were storing as a Cookie on Client Side to
remember Session on Server.
Points To Remember
• If Cookieless Enabled Then Session Id is passed back and forth in form of URL
• Server uses the Session Id to keep track of all the variables stored in
Session[“value”] object & Identifies the User.
• For Cookieless Session to work correctly relative URL are important no absolute
URL are allowed if we want Session object data.
• Eg. Response.Redirect(“~/WebForm2.aspx”);  Allowed
• Response.Redirect(“http://xyz.com/WebForm2.aspx”);  Not Allowed.
C# cookieless session id and application state
C# cookieless session id and application state
Application State
• We all know that the web uses the HTTP protocol and that the HTTP
protocol is a stateless protocol, in other words when a client sends a request
to the server, an instance of the page is created and the page is converted to
HTML format and then the server returns the response and then the
instance of the page and the value of the control is destroyed. So if we have
a requirement to store the value of controls then a State Management
technique is used.Server uses the Session Id to keep track of all the variables
stored in Session[“value”] object & Identifies the User.
Application State
• Application State is a state management technique. Application State is
stored in the memory of the the server and is faster than storing and
retrieving information in a database. Session state is specific for a single user
session, but Application State is for all users and sessions. Application State
does not have a default expiration period. When we close the worker process
the application object will be lost. Technically the data is shared amongst
users by a HTTPApplcationState class and the data can be stored here in a
key/value pair. It can also be accessed using the application property of the
HTTPContext class.
Syntax of Application State
• Store information in application state:
Application[“name”] = “Justin”;
• Retrieve information from application state:
string str = Application[“name”].ToString();
Application State Example
• Design web page in visual studio as shows in below figure.
• Here, we calculate total visit of uses visited web page by clicking “Click to Visit” button.
• C# Code for Example
protected void btnvisit_Click(object sender, EventArgs e){
Application.Lock();
int count = 0;
if (Application["Visit"] != null){
count = Convert.ToInt32(Application["Visit"].ToString());
}
count = count + 1;
Application["Visit"] = count;
Application.UnLock();
Label1.Text = "Total Visit = " + count.ToString();
}
Output
THANK YOU
1 de 16

Recomendados

Lecture1 por
Lecture1Lecture1
Lecture1Châu Thanh Chương
684 vistas17 diapositivas
state managment por
state managment state managment
state managment aniliimd
1.5K vistas11 diapositivas
ASP.NET lecture 8 por
ASP.NET lecture 8ASP.NET lecture 8
ASP.NET lecture 8Julie Iskander
1.7K vistas32 diapositivas
ASP.NET Lecture 2 por
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2Julie Iskander
7.2K vistas62 diapositivas
Lecture 10 Answers por
Lecture 10 AnswersLecture 10 Answers
Lecture 10 Answersis4030.ray
238 vistas8 diapositivas
Understanding Web Applications and Web Testing Tools - QAConf por
Understanding Web Applications and Web Testing Tools - QAConfUnderstanding Web Applications and Web Testing Tools - QAConf
Understanding Web Applications and Web Testing Tools - QAConfnarayanraman
665 vistas15 diapositivas

Más contenido relacionado

La actualidad más candente

ASP.NET Overview - Alvin Lau por
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
3.2K vistas31 diapositivas
Onboarding ibos por
Onboarding ibosOnboarding ibos
Onboarding ibosEmily Bauman
160 vistas8 diapositivas
Js il 2013 breeze.js por
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.jsEyal Vardi
3.9K vistas19 diapositivas
Introduction to BreezeJs por
Introduction to BreezeJsIntroduction to BreezeJs
Introduction to BreezeJsAnuradha Malalasena
1K vistas15 diapositivas
Real World Challenges in SharePoint 2013 Search por
Real World Challenges in SharePoint 2013 SearchReal World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 SearchAgnes Molnar
2.5K vistas22 diapositivas
Cejv659 week09 glassfish-s14 por
Cejv659 week09 glassfish-s14Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14Ken Fogel
32.3K vistas16 diapositivas

La actualidad más candente(6)

ASP.NET Overview - Alvin Lau por Spiffy
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
Spiffy3.2K vistas
Js il 2013 breeze.js por Eyal Vardi
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.js
Eyal Vardi3.9K vistas
Real World Challenges in SharePoint 2013 Search por Agnes Molnar
Real World Challenges in SharePoint 2013 SearchReal World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 Search
Agnes Molnar2.5K vistas
Cejv659 week09 glassfish-s14 por Ken Fogel
Cejv659 week09 glassfish-s14Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14
Ken Fogel32.3K vistas

Similar a C# cookieless session id and application state

State management in ASP.net por
State  management in ASP.netState  management in ASP.net
State management in ASP.netbaabtra.com - No. 1 supplier of quality freshers
2.6K vistas25 diapositivas
State management in ASP .NET por
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NETbaabtra.com - No. 1 supplier of quality freshers
5.6K vistas25 diapositivas
Enterprise java unit-2_chapter-3 por
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3sandeep54552
561 vistas21 diapositivas
Session and state management por
Session and state managementSession and state management
Session and state managementPaneliya Prince
173 vistas89 diapositivas
Session and cookies,get and post por
Session and cookies,get and postSession and cookies,get and post
Session and cookies,get and postbaabtra.com - No. 1 supplier of quality freshers
840 vistas29 diapositivas
State management por
State managementState management
State managementLalit Kale
1.3K vistas21 diapositivas

Similar a C# cookieless session id and application state(20)

Enterprise java unit-2_chapter-3 por sandeep54552
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
sandeep54552561 vistas
State management por Lalit Kale
State managementState management
State management
Lalit Kale1.3K vistas
Session and Cookies.pdf por HamnaGhani1
Session and Cookies.pdfSession and Cookies.pdf
Session and Cookies.pdf
HamnaGhani12 vistas
State management por Iblesoft
State managementState management
State management
Iblesoft1.1K vistas
ASP.NET 12 - State Management por Randy Connolly
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
Randy Connolly3.3K vistas
Session 32 - Session Management using Cookies por PawanMM
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
PawanMM56 vistas
Using cookies and sessions por Nuha Noor
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
Nuha Noor1.2K vistas
State management por Iblesoft
State managementState management
State management
Iblesoft6.9K vistas
05 asp.net session07 por Vivek chan
05 asp.net session0705 asp.net session07
05 asp.net session07
Vivek chan126 vistas

Último

Design of machine elements-UNIT 3.pptx por
Design of machine elements-UNIT 3.pptxDesign of machine elements-UNIT 3.pptx
Design of machine elements-UNIT 3.pptxgopinathcreddy
34 vistas31 diapositivas
MK__Cert.pdf por
MK__Cert.pdfMK__Cert.pdf
MK__Cert.pdfHassan Khan
16 vistas1 diapositiva
Ansari: Practical experiences with an LLM-based Islamic Assistant por
Ansari: Practical experiences with an LLM-based Islamic AssistantAnsari: Practical experiences with an LLM-based Islamic Assistant
Ansari: Practical experiences with an LLM-based Islamic AssistantM Waleed Kadous
7 vistas29 diapositivas
MongoDB.pdf por
MongoDB.pdfMongoDB.pdf
MongoDB.pdfArthyR3
49 vistas6 diapositivas
dummy.pptx por
dummy.pptxdummy.pptx
dummy.pptxJamesLamp
5 vistas2 diapositivas
Pitchbook Repowerlab.pdf por
Pitchbook Repowerlab.pdfPitchbook Repowerlab.pdf
Pitchbook Repowerlab.pdfVictoriaGaleano
5 vistas12 diapositivas

Último(20)

Design of machine elements-UNIT 3.pptx por gopinathcreddy
Design of machine elements-UNIT 3.pptxDesign of machine elements-UNIT 3.pptx
Design of machine elements-UNIT 3.pptx
gopinathcreddy34 vistas
Ansari: Practical experiences with an LLM-based Islamic Assistant por M Waleed Kadous
Ansari: Practical experiences with an LLM-based Islamic AssistantAnsari: Practical experiences with an LLM-based Islamic Assistant
Ansari: Practical experiences with an LLM-based Islamic Assistant
M Waleed Kadous7 vistas
MongoDB.pdf por ArthyR3
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
ArthyR349 vistas
Web Dev Session 1.pptx por VedVekhande
Web Dev Session 1.pptxWeb Dev Session 1.pptx
Web Dev Session 1.pptx
VedVekhande13 vistas
Proposal Presentation.pptx por keytonallamon
Proposal Presentation.pptxProposal Presentation.pptx
Proposal Presentation.pptx
keytonallamon63 vistas
Searching in Data Structure por raghavbirla63
Searching in Data StructureSearching in Data Structure
Searching in Data Structure
raghavbirla6314 vistas
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx por lwang78
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
lwang78165 vistas
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf por AlhamduKure
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdfASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf
AlhamduKure6 vistas
SUMIT SQL PROJECT SUPERSTORE 1.pptx por Sumit Jadhav
SUMIT SQL PROJECT SUPERSTORE 1.pptxSUMIT SQL PROJECT SUPERSTORE 1.pptx
SUMIT SQL PROJECT SUPERSTORE 1.pptx
Sumit Jadhav 22 vistas
GDSC Mikroskil Members Onboarding 2023.pdf por gdscmikroskil
GDSC Mikroskil Members Onboarding 2023.pdfGDSC Mikroskil Members Onboarding 2023.pdf
GDSC Mikroskil Members Onboarding 2023.pdf
gdscmikroskil59 vistas
Design_Discover_Develop_Campaign.pptx por ShivanshSeth6
Design_Discover_Develop_Campaign.pptxDesign_Discover_Develop_Campaign.pptx
Design_Discover_Develop_Campaign.pptx
ShivanshSeth645 vistas
Créativité dans le design mécanique à l’aide de l’optimisation topologique por LIEGE CREATIVE
Créativité dans le design mécanique à l’aide de l’optimisation topologiqueCréativité dans le design mécanique à l’aide de l’optimisation topologique
Créativité dans le design mécanique à l’aide de l’optimisation topologique
LIEGE CREATIVE5 vistas

C# cookieless session id and application state

  • 1. G. H. PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY 2160711 DOT NET TECHNOLOGY ACADEMIC YEAR : 2018-19 (EVEN) (6th sem) Group members : JUSTIN PATEL 160110107039 MALAV PATEL 160110107040 Guided By, Prof. Khyati Mehta
  • 3. State Management Basic’s • A Web Form / Page follows Stateless Model ie. The Server does not have any information about who is requesting the page. • Therefore to keep the Website more interactive we need to remember some variables like username, items in cart for a shopping website, if the website had the user has logged in once then we don’t have to make him login again and again. • To make the Website Stateful ASP.NET Framework provides various ways to preserve the state of website.
  • 4. Sate Management Methods • Client Side Methods – • ViewState • Hidden Fields • Query Strings • Cookies • Control State • Server Side Methods • Application State • Session State
  • 5. To Main Point – Session’s • Session is Server side method for State Management. • Session use Session Id to keep track of the user. • Session Id are random strings generated by ASP.NET when the page is request by a form submission or first entry. • Session is defined in web.config to remember for 20 min by default. • Session’s use Cookies to store the information of Session Id , But … • why use Cookies to store the session id what if cookies are disabled on user side.
  • 6. How To Cookie-less Session • In web.config file enable Cookieless to true to enable Cookie-less Sessions. • <sessionState mode="InProc" cookieless="true"></sessionState> • With is being done we will notice some funky change in our site URL. • Default  localhost:27858/WebForm1.aspx • Cookieless Enabled  http://localhost:60829/(S(f2lgip3ryfnlm4kpyfico03y))/WebForm1.aspx • This String is the Session Id which we were storing as a Cookie on Client Side to remember Session on Server.
  • 7. Points To Remember • If Cookieless Enabled Then Session Id is passed back and forth in form of URL • Server uses the Session Id to keep track of all the variables stored in Session[“value”] object & Identifies the User. • For Cookieless Session to work correctly relative URL are important no absolute URL are allowed if we want Session object data. • Eg. Response.Redirect(“~/WebForm2.aspx”);  Allowed • Response.Redirect(“http://xyz.com/WebForm2.aspx”);  Not Allowed.
  • 10. Application State • We all know that the web uses the HTTP protocol and that the HTTP protocol is a stateless protocol, in other words when a client sends a request to the server, an instance of the page is created and the page is converted to HTML format and then the server returns the response and then the instance of the page and the value of the control is destroyed. So if we have a requirement to store the value of controls then a State Management technique is used.Server uses the Session Id to keep track of all the variables stored in Session[“value”] object & Identifies the User.
  • 11. Application State • Application State is a state management technique. Application State is stored in the memory of the the server and is faster than storing and retrieving information in a database. Session state is specific for a single user session, but Application State is for all users and sessions. Application State does not have a default expiration period. When we close the worker process the application object will be lost. Technically the data is shared amongst users by a HTTPApplcationState class and the data can be stored here in a key/value pair. It can also be accessed using the application property of the HTTPContext class.
  • 12. Syntax of Application State • Store information in application state: Application[“name”] = “Justin”; • Retrieve information from application state: string str = Application[“name”].ToString();
  • 13. Application State Example • Design web page in visual studio as shows in below figure.
  • 14. • Here, we calculate total visit of uses visited web page by clicking “Click to Visit” button. • C# Code for Example protected void btnvisit_Click(object sender, EventArgs e){ Application.Lock(); int count = 0; if (Application["Visit"] != null){ count = Convert.ToInt32(Application["Visit"].ToString()); } count = count + 1; Application["Visit"] = count; Application.UnLock(); Label1.Text = "Total Visit = " + count.ToString(); }