SlideShare a Scribd company logo
1 of 16
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
 
Js il 2013 breeze.js
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.jsEyal Vardi
 
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-s14Ken 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 (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

Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesRashidFaridChishti
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelDrAjayKumarYadav4
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxhublikarsn
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257subhasishdas79
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 

Recently uploaded (20)

Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 

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(); }