SlideShare a Scribd company logo
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.
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

More Related Content

What's hot

ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
Onboarding ibos
Onboarding ibosOnboarding ibos
Onboarding ibos
Emily Bauman
 
Js il 2013 breeze.js
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.js
Eyal Vardi
 
Introduction to BreezeJs
Introduction to BreezeJsIntroduction to BreezeJs
Introduction to BreezeJs
Anuradha Malalasena
 
Real World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 SearchReal World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 SearchAgnes Molnar
 
Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14
Ken Fogel
 

What's hot (6)

ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
Onboarding ibos
Onboarding ibosOnboarding ibos
Onboarding ibos
 
Js il 2013 breeze.js
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.js
 
Introduction to BreezeJs
Introduction to BreezeJsIntroduction to BreezeJs
Introduction to BreezeJs
 
Real World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 SearchReal World Challenges in SharePoint 2013 Search
Real World Challenges in SharePoint 2013 Search
 
Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14
 

Similar to C# cookieless session id and application state

State management in ASP.net
State  management in ASP.netState  management in ASP.net
State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
sandeep54552
 
Session and state management
Session and state managementSession and state management
Session and state management
Paneliya Prince
 
State management
State managementState management
State management
Lalit Kale
 
State Management.pptx
State Management.pptxState Management.pptx
State Management.pptx
DrMonikaPatel2
 
session and cookies.ppt
session and cookies.pptsession and cookies.ppt
session and cookies.ppt
Jayaprasanna4
 
Session and Cookies.pdf
Session and Cookies.pdfSession and Cookies.pdf
Session and Cookies.pdf
HamnaGhani1
 
State management
State managementState management
State managementIblesoft
 
ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
Randy Connolly
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
PawanMM
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
Nuha Noor
 
Asp.net
Asp.netAsp.net
SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6
Ben Abdallah Helmi
 
State management in asp.net
State management in asp.netState management in asp.net
State management
State managementState management
State managementIblesoft
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
Vivek chan
 
state management asp.net
 state management asp.net state management asp.net
state management asp.net
Pratiksha Srivastava
 

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

State management in ASP.net
State  management in ASP.netState  management in ASP.net
State management in ASP.net
 
State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NET
 
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
 
Session and state management
Session and state managementSession and state management
Session and state management
 
Session and cookies,get and post
Session and cookies,get and postSession and cookies,get and post
Session and cookies,get and post
 
State management
State managementState management
State management
 
State Management.pptx
State Management.pptxState Management.pptx
State Management.pptx
 
Chapter 8 part1
Chapter 8   part1Chapter 8   part1
Chapter 8 part1
 
session and cookies.ppt
session and cookies.pptsession and cookies.ppt
session and cookies.ppt
 
Session and Cookies.pdf
Session and Cookies.pdfSession and Cookies.pdf
Session and Cookies.pdf
 
State management
State managementState management
State management
 
ASP.NET 12 - State Management
ASP.NET 12 - State ManagementASP.NET 12 - State Management
ASP.NET 12 - State Management
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
 
Asp.net
Asp.netAsp.net
Asp.net
 
SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6
 
State management in asp.net
State management in asp.netState management in asp.net
State management in asp.net
 
State management
State managementState management
State management
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
state management asp.net
 state management asp.net state management asp.net
state management asp.net
 

Recently uploaded

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 

Recently uploaded (20)

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 

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.
  • 8.
  • 9.
  • 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(); }