SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Sessions and Cookies
Sessions and Cookies
Vi l P i
Vi l P i
Visual Programming
CS 783
Asim Israr
Visual Programming
CS 783
Asim Israr
Asim Israr
Asim Israr
What is Session?
A session is defined as the period of time
that a unique user interacts with a web
that a unique user interacts with a web
application.
Session state
Session state
• Programmatically, session state is
nothing more than memory in the
shape of a dictionary or hash table,
e.g. key-value pairs, which can be set
and read for the duration of a user's
session
ASP Session State
ASP Session State
• ASP maintains session state by
providing the client with a unique key
assigned to the user when the
session begins
• This key is stored in an HTTP cookie
y
that the client sends to the server on
each request.
q
• The server can then read the key
from the cookie and re-inflate the
from the cookie and re inflate the
server session state.
ASP Session State
P bl
Problems
• Process dependent
– ASP session state exists in the process that
hosts ASP
S f li it ti
• Server farm limitations
– ASP session state is machine specific. Each
ASP server provides its own session state and
ASP server provides its own session state, and
unless the user returns to the same server, the
session state is inaccessible
• Cookie dependent
– Clients that don't accept HTTP cookies can't
take advantage of session state
take advantage of session state
ASP.NET session state solves all of the
above problems associated with classic
ASP session state
• Process independent
p
– ASP.NET session state is able to run in a separate
process from the ASP.NET host process
• Support for server farm configurations
– By moving to an out-of-process model, ASP.NET
also solves the server farm problem
also solves the server farm problem
• Cookie independent
Cookieless session state support through simple
– Cookieless session state support through simple
configurations
Session Configurations
Session Configurations
fi i
<configuration>
<sessionstate
mode="inproc"
cookieless="false"
cookieless= false
timeout="20"
sqlconnectionstring="data
source=127 0 0 1;user id=<user
source 127.0.0.1;user id <user
id>;password=<password>"
server="127.0.0.1"
port="42424" />
p
</configuration>
Session Configurations
Session Configurations
• Mode. The mode setting supports
three options: inproc, sqlserver, and
stateserver. ASP.NET supports two
modes: in process and out of
process. There are also two options
for out-of-process state management:
memory based (stateserver), and
SQL Server based (sqlserver).
Session Configurations
Session Configurations
• Cookieless. The cookieless option for
ASP.NET is configured with simple
Boolean setting.
• Timeout. This option controls the
length of time a session is considered
g
valid. The session timeout is a sliding
value; on each request the timeout
q
period is set to the current time plus
the timeout value
Session Configurations
Session Configurations
• Sqlconnectionstring. The
sqlconnectionstring identifies the
database connection string that
names the database used for mode
sqlserver.
• Server. In the out-of-process mode
stateserver, it names the server that
is running the required Windows NT
service: ASPState.
Session Configurations
Session Configurations
• Port. The port setting, which
accompanies the server setting,
identifies the port number that
corresponds to the server setting for
mode stateserver.
Performance and Reliability
Considerations
• In process
In process
– In process will perform best because the
session state memory is kept within the
y p
ASP.NET process.
– For Web applications hosted on a single
pp g
server, applications in which the user is
guaranteed to be re-directed to the
h i
correct server, or when session state
data is not critical, this is the mode to
choose
choose.
Performance and Reliability
Considerations
• Out of process
Out of process
– This mode is best used when
performance is important but you can't
p p y
guarantee which server a user will
request an application from.
– With out-of-process mode, you get the
performance of reading from memory
d h li bili f
and the reliability of a separate process
that manages the state for all servers.
Performance and Reliability
Considerations
• SQL Server
SQL Server
– This mode is best used when the
reliability of the data is fundamental to
y
the stability of the application, as the
database can be clustered for failure
scenarios.
– The performance isn't as fast as out of
b h d ff i h hi h
process, but the tradeoff is the higher
level of reliability.
What is Cookie?
A cookie is a small bit of text that accompanies
requests and pages as they go between the
q p g y g
web server and browser.
Contains information the web application can
read whenever the user visits the site
Background
Background
• For example, if a user requests a
page from your site and your
application sends not just a page, but
also a cookie containing the date and
time, when the user's browser gets
the page, the browser also gets the
cookie, which it stores in a folder on
the user's hard disk.
Background
Background
• Later, if user requests a page from
your site again, when the user enters
the URL the browser looks on the
local hard disk for a cookie
associated with the URL.
• If the cookie exists, the browser
sends the cookie to your site along
y g
with the page request.
Background
Background
• Your application can then determine
the date and time that the user last
visited the site.
• You might use the information to
display a message to the user or
p y g
check an expiration date.
Background
Background
• Cookies are associated with a Web
site, not with a specific page, so the
browser and server will exchange
cookie information no matter what
page the user requests from your
site.
• As the user visits different sites, each
site might send a cookie to the user's
browser as well; the browser stores
all the cookies separately.
Usage
Usage
• Cookies are used for many purposes,
all relating to helping the Web site
remember users
• For example, a site conducting a poll
might use a cookie simply as a
g p y
Boolean value to indicate whether a
user's browser has already
y
participated in voting so that the user
cannot vote twice.
Usage
Usage
• A site that asks a user to log on might
use a cookie to record that the user
already logged on so that the user
does not have to keep entering
credentials.
Limitations
Limitations
• Most browsers support cookies of up
to 4096 bytes.
– Because of this small limit, cookies are
best used to store small amounts of
data
• Browsers also impose limitations on
how many cookies your site can store
on the user's computer
• Users can set their browser to refuse
cookies

Contenu connexe

Similaire à Session and Cookies.pdf

IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivitypkaviya
 
Session,Cookies and Authentication
Session,Cookies and AuthenticationSession,Cookies and Authentication
Session,Cookies and AuthenticationKnoldus Inc.
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
Enterprise java unit-2_chapter-2
Enterprise  java unit-2_chapter-2Enterprise  java unit-2_chapter-2
Enterprise java unit-2_chapter-2sandeep54552
 
SPSUtah 2014 SharePoint 2013 Performance (Admin)
SPSUtah 2014 SharePoint 2013 Performance (Admin)SPSUtah 2014 SharePoint 2013 Performance (Admin)
SPSUtah 2014 SharePoint 2013 Performance (Admin)Brian Culver
 
Session and state management
Session and state managementSession and state management
Session and state managementPaneliya Prince
 
SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921Marco Obinu
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...Amazon Web Services
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSPC Adriatics
 
Module-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQueryModule-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQuerySIVAKUMAR V
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessionsNuha Noor
 
Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB nonlinear creations
 
Lesson 1 configuring
Lesson 1   configuringLesson 1   configuring
Lesson 1 configuringRam Kedem
 

Similaire à Session and Cookies.pdf (20)

State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NET
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
 
Session,Cookies and Authentication
Session,Cookies and AuthenticationSession,Cookies and Authentication
Session,Cookies and Authentication
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
PHP - Introduction to PHP Cookies and Sessions
PHP - Introduction to PHP Cookies and SessionsPHP - Introduction to PHP Cookies and Sessions
PHP - Introduction to PHP Cookies and Sessions
 
Client&server side scripting
Client&server side scriptingClient&server side scripting
Client&server side scripting
 
Enterprise java unit-2_chapter-2
Enterprise  java unit-2_chapter-2Enterprise  java unit-2_chapter-2
Enterprise java unit-2_chapter-2
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
SPSUtah 2014 SharePoint 2013 Performance (Admin)
SPSUtah 2014 SharePoint 2013 Performance (Admin)SPSUtah 2014 SharePoint 2013 Performance (Admin)
SPSUtah 2014 SharePoint 2013 Performance (Admin)
 
Session and state management
Session and state managementSession and state management
Session and state management
 
SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921SQL Server Lift & Shift on Azure - SQL Saturday 921
SQL Server Lift & Shift on Azure - SQL Saturday 921
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi Vončina
 
Module-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQueryModule-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQuery
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
 
Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB Sitecore User Group: Session State and Sitecore xDB
Sitecore User Group: Session State and Sitecore xDB
 
Session State and Sitecore xDB
Session State and Sitecore xDBSession State and Sitecore xDB
Session State and Sitecore xDB
 
Lesson 1 configuring
Lesson 1   configuringLesson 1   configuring
Lesson 1 configuring
 

Dernier

💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋
💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋
💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋Sheetaleventcompany
 
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...riyadelhic riyadelhic
 
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.riyadelhic riyadelhic
 
Mysore Call girl service 6289102337 Mysore escort service
Mysore Call girl service 6289102337 Mysore escort serviceMysore Call girl service 6289102337 Mysore escort service
Mysore Call girl service 6289102337 Mysore escort servicemaheshsingh64440
 
CALL GIRLS 9999288940 women seeking men Locanto No Advance North Goa
CALL GIRLS 9999288940 women seeking men Locanto No Advance North GoaCALL GIRLS 9999288940 women seeking men Locanto No Advance North Goa
CALL GIRLS 9999288940 women seeking men Locanto No Advance North Goadelhincr993
 
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...Sheetaleventcompany
 
VAPI CALL GIRL 92628/71154 VAPI CALL GIR
VAPI CALL GIRL 92628/71154 VAPI CALL GIRVAPI CALL GIRL 92628/71154 VAPI CALL GIR
VAPI CALL GIRL 92628/71154 VAPI CALL GIRNiteshKumar82226
 
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Service
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts ServiceCall Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Service
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Serviceteencall080
 
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...riyadelhic riyadelhic
 
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.riyadelhic riyadelhic
 
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...aakahthapa70
 
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGAR
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGARJAMNAGAR CALL GIRLS 92628/71154 JAMNAGAR
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGARNiteshKumar82226
 
Call Girls in Rawalpindi | 🍆💦 03280288848
Call Girls in Rawalpindi | 🍆💦 03280288848Call Girls in Rawalpindi | 🍆💦 03280288848
Call Girls in Rawalpindi | 🍆💦 03280288848Ifra Zohaib
 
Girls For Night in Islamabad | 03274100048 🔞
Girls For Night in Islamabad | 03274100048 🔞Girls For Night in Islamabad | 03274100048 🔞
Girls For Night in Islamabad | 03274100048 🔞Ifra Zohaib
 
BADDI CALL GIRL 92628/71154 BADDI CALL G
BADDI CALL GIRL 92628/71154 BADDI CALL GBADDI CALL GIRL 92628/71154 BADDI CALL G
BADDI CALL GIRL 92628/71154 BADDI CALL GNiteshKumar82226
 
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7Sana Rajpoot
 
Russian Call Girls in Goa %(9316020077)# Russian Call Girls in Goa By Russi...
Russian Call Girls  in Goa %(9316020077)# Russian Call Girls  in Goa By Russi...Russian Call Girls  in Goa %(9316020077)# Russian Call Girls  in Goa By Russi...
Russian Call Girls in Goa %(9316020077)# Russian Call Girls in Goa By Russi...Goa Call Girls Service Goa escort agency
 
Call Girls | 😏💦 03274100048 | Call Girls Near Me
Call Girls | 😏💦 03274100048 | Call Girls Near MeCall Girls | 😏💦 03274100048 | Call Girls Near Me
Call Girls | 😏💦 03274100048 | Call Girls Near MeIfra Zohaib
 
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...riyasharma00119
 

Dernier (20)

💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋
💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋
💚😋Bangalore Escort Service Call Girls, ₹5000 To 25K With AC💚😋
 
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...
Call Now HIgh profile ☎9870417354|| Call Girls in Ghaziabad Escort Service De...
 
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.
Call Now ☎9870417354|| Call Girls in Dwarka Escort Service Delhi N.C.R.
 
Mysore Call girl service 6289102337 Mysore escort service
Mysore Call girl service 6289102337 Mysore escort serviceMysore Call girl service 6289102337 Mysore escort service
Mysore Call girl service 6289102337 Mysore escort service
 
CALL GIRLS 9999288940 women seeking men Locanto No Advance North Goa
CALL GIRLS 9999288940 women seeking men Locanto No Advance North GoaCALL GIRLS 9999288940 women seeking men Locanto No Advance North Goa
CALL GIRLS 9999288940 women seeking men Locanto No Advance North Goa
 
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...
Call Girl Rohini ❤️7065000506 Pooja@ Rohini Call Girls Near Me ❤️♀️@ Sexy Cal...
 
VAPI CALL GIRL 92628/71154 VAPI CALL GIR
VAPI CALL GIRL 92628/71154 VAPI CALL GIRVAPI CALL GIRL 92628/71154 VAPI CALL GIR
VAPI CALL GIRL 92628/71154 VAPI CALL GIR
 
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Service
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts ServiceCall Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Service
Call Girls in Mukherjee Nagar Delhi 8826158885 Genuine Escorts Service
 
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...
Call Now ☎9870417354|| Call Girls in Gurgaon Sector 13 Escort Service Gurgaon...
 
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.
Call Now ☎9870417354|| Call Girls in Noida Sector 12 Escort Service Noida N.C.R.
 
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
Call Girls In {{Connaught Place Delhi}}96679@38988 Indian Russian High Profil...
 
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGAR
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGARJAMNAGAR CALL GIRLS 92628/71154 JAMNAGAR
JAMNAGAR CALL GIRLS 92628/71154 JAMNAGAR
 
Call Girls in Rawalpindi | 🍆💦 03280288848
Call Girls in Rawalpindi | 🍆💦 03280288848Call Girls in Rawalpindi | 🍆💦 03280288848
Call Girls in Rawalpindi | 🍆💦 03280288848
 
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
9953056974 Call Girls In Ashok Nagar, Escorts (Delhi) NCR.
 
Girls For Night in Islamabad | 03274100048 🔞
Girls For Night in Islamabad | 03274100048 🔞Girls For Night in Islamabad | 03274100048 🔞
Girls For Night in Islamabad | 03274100048 🔞
 
BADDI CALL GIRL 92628/71154 BADDI CALL G
BADDI CALL GIRL 92628/71154 BADDI CALL GBADDI CALL GIRL 92628/71154 BADDI CALL G
BADDI CALL GIRL 92628/71154 BADDI CALL G
 
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
Call Girls In Lahore || 03274100048 ||Lahore Call Girl Available 24/7
 
Russian Call Girls in Goa %(9316020077)# Russian Call Girls in Goa By Russi...
Russian Call Girls  in Goa %(9316020077)# Russian Call Girls  in Goa By Russi...Russian Call Girls  in Goa %(9316020077)# Russian Call Girls  in Goa By Russi...
Russian Call Girls in Goa %(9316020077)# Russian Call Girls in Goa By Russi...
 
Call Girls | 😏💦 03274100048 | Call Girls Near Me
Call Girls | 😏💦 03274100048 | Call Girls Near MeCall Girls | 😏💦 03274100048 | Call Girls Near Me
Call Girls | 😏💦 03274100048 | Call Girls Near Me
 
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...
Low Rate Russian Call Girls In Lajpat Nagar ➡️ 7836950116 Call Girls Service ...
 

Session and Cookies.pdf

  • 1. Sessions and Cookies Sessions and Cookies Vi l P i Vi l P i Visual Programming CS 783 Asim Israr Visual Programming CS 783 Asim Israr Asim Israr Asim Israr
  • 2. What is Session? A session is defined as the period of time that a unique user interacts with a web that a unique user interacts with a web application.
  • 3. Session state Session state • Programmatically, session state is nothing more than memory in the shape of a dictionary or hash table, e.g. key-value pairs, which can be set and read for the duration of a user's session
  • 4. ASP Session State ASP Session State • ASP maintains session state by providing the client with a unique key assigned to the user when the session begins • This key is stored in an HTTP cookie y that the client sends to the server on each request. q • The server can then read the key from the cookie and re-inflate the from the cookie and re inflate the server session state.
  • 5. ASP Session State P bl Problems • Process dependent – ASP session state exists in the process that hosts ASP S f li it ti • Server farm limitations – ASP session state is machine specific. Each ASP server provides its own session state and ASP server provides its own session state, and unless the user returns to the same server, the session state is inaccessible • Cookie dependent – Clients that don't accept HTTP cookies can't take advantage of session state take advantage of session state
  • 6. ASP.NET session state solves all of the above problems associated with classic ASP session state • Process independent p – ASP.NET session state is able to run in a separate process from the ASP.NET host process • Support for server farm configurations – By moving to an out-of-process model, ASP.NET also solves the server farm problem also solves the server farm problem • Cookie independent Cookieless session state support through simple – Cookieless session state support through simple configurations
  • 7. Session Configurations Session Configurations fi i <configuration> <sessionstate mode="inproc" cookieless="false" cookieless= false timeout="20" sqlconnectionstring="data source=127 0 0 1;user id=<user source 127.0.0.1;user id <user id>;password=<password>" server="127.0.0.1" port="42424" /> p </configuration>
  • 8. Session Configurations Session Configurations • Mode. The mode setting supports three options: inproc, sqlserver, and stateserver. ASP.NET supports two modes: in process and out of process. There are also two options for out-of-process state management: memory based (stateserver), and SQL Server based (sqlserver).
  • 9. Session Configurations Session Configurations • Cookieless. The cookieless option for ASP.NET is configured with simple Boolean setting. • Timeout. This option controls the length of time a session is considered g valid. The session timeout is a sliding value; on each request the timeout q period is set to the current time plus the timeout value
  • 10. Session Configurations Session Configurations • Sqlconnectionstring. The sqlconnectionstring identifies the database connection string that names the database used for mode sqlserver. • Server. In the out-of-process mode stateserver, it names the server that is running the required Windows NT service: ASPState.
  • 11. Session Configurations Session Configurations • Port. The port setting, which accompanies the server setting, identifies the port number that corresponds to the server setting for mode stateserver.
  • 12. Performance and Reliability Considerations • In process In process – In process will perform best because the session state memory is kept within the y p ASP.NET process. – For Web applications hosted on a single pp g server, applications in which the user is guaranteed to be re-directed to the h i correct server, or when session state data is not critical, this is the mode to choose choose.
  • 13. Performance and Reliability Considerations • Out of process Out of process – This mode is best used when performance is important but you can't p p y guarantee which server a user will request an application from. – With out-of-process mode, you get the performance of reading from memory d h li bili f and the reliability of a separate process that manages the state for all servers.
  • 14. Performance and Reliability Considerations • SQL Server SQL Server – This mode is best used when the reliability of the data is fundamental to y the stability of the application, as the database can be clustered for failure scenarios. – The performance isn't as fast as out of b h d ff i h hi h process, but the tradeoff is the higher level of reliability.
  • 15. What is Cookie? A cookie is a small bit of text that accompanies requests and pages as they go between the q p g y g web server and browser. Contains information the web application can read whenever the user visits the site
  • 16. Background Background • For example, if a user requests a page from your site and your application sends not just a page, but also a cookie containing the date and time, when the user's browser gets the page, the browser also gets the cookie, which it stores in a folder on the user's hard disk.
  • 17. Background Background • Later, if user requests a page from your site again, when the user enters the URL the browser looks on the local hard disk for a cookie associated with the URL. • If the cookie exists, the browser sends the cookie to your site along y g with the page request.
  • 18. Background Background • Your application can then determine the date and time that the user last visited the site. • You might use the information to display a message to the user or p y g check an expiration date.
  • 19. Background Background • Cookies are associated with a Web site, not with a specific page, so the browser and server will exchange cookie information no matter what page the user requests from your site. • As the user visits different sites, each site might send a cookie to the user's browser as well; the browser stores all the cookies separately.
  • 20. Usage Usage • Cookies are used for many purposes, all relating to helping the Web site remember users • For example, a site conducting a poll might use a cookie simply as a g p y Boolean value to indicate whether a user's browser has already y participated in voting so that the user cannot vote twice.
  • 21. Usage Usage • A site that asks a user to log on might use a cookie to record that the user already logged on so that the user does not have to keep entering credentials.
  • 22. Limitations Limitations • Most browsers support cookies of up to 4096 bytes. – Because of this small limit, cookies are best used to store small amounts of data • Browsers also impose limitations on how many cookies your site can store on the user's computer • Users can set their browser to refuse cookies