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

More Related Content

Similar to Session and Cookies.pdf

State management in ASP .NET
State  management in ASP .NETState  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
pkaviya
 
Session,Cookies and Authentication
Session,Cookies and AuthenticationSession,Cookies and Authentication
Session,Cookies and Authentication
Knoldus Inc.
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
Kamal Acharya
 
Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
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
Vibrant Technologies & Computers
 
Client&server side scripting
Client&server side scriptingClient&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
sandeep54552
 
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 management
Paneliya 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 921
Marco 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čina
SPC Adriatics
 
Module-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQueryModule-5_WTA_Managing State & jQuery
Module-5_WTA_Managing State & jQuery
SIVAKUMAR V
 
Advance Java
Advance JavaAdvance Java
Advance Java
Maitree Patel
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
Nuha 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
 
Session State and Sitecore xDB
Session State and Sitecore xDBSession State and Sitecore xDB
Session State and Sitecore xDB
Harpreet Singh, PMP, ITIL
 
Lesson 1 configuring
Lesson 1   configuringLesson 1   configuring
Lesson 1 configuring
Ram Kedem
 

Similar to 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
 

Recently uploaded

Elevate Your Brand with Digital Marketing for Fashion Industry
Elevate Your Brand with Digital Marketing for Fashion IndustryElevate Your Brand with Digital Marketing for Fashion Industry
Elevate Your Brand with Digital Marketing for Fashion Industry
Matebiz Pvt. Ltd
 
Are Gutters Necessary? Explore the details now!
Are Gutters Necessary? Explore the details now!Are Gutters Necessary? Explore the details now!
Are Gutters Necessary? Explore the details now!
AmeliaLauren3
 
WORK PERMIT IN BULGARIA | Work Visa Services
WORK PERMIT IN BULGARIA | Work Visa ServicesWORK PERMIT IN BULGARIA | Work Visa Services
WORK PERMIT IN BULGARIA | Work Visa Services
RKIMT
 
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docxIslamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
amilabibi1
 
Colors of Wall Paint and Their Mentally Properties.pptx
Colors of Wall Paint and Their Mentally Properties.pptxColors of Wall Paint and Their Mentally Properties.pptx
Colors of Wall Paint and Their Mentally Properties.pptx
Brendon Jonathan
 
Reliable Logistics Solutions - Truxcargo
Reliable Logistics Solutions - TruxcargoReliable Logistics Solutions - Truxcargo
Reliable Logistics Solutions - Truxcargo
Truxcargo
 
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
Softradix Technologies
 
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
RNayak3
 
The Best Premium IPTV Service Frane.docx
The Best Premium IPTV Service Frane.docxThe Best Premium IPTV Service Frane.docx
The Best Premium IPTV Service Frane.docx
Industry Foods UK
 
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROLSECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
securexukweb
 
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
gitapress3
 
Chandigarh call garal serives 9512450098
Chandigarh call garal serives 9512450098Chandigarh call garal serives 9512450098
Chandigarh call garal serives 9512450098
Chandigarh export services garal
 
Best Catering Event Planner Miso-Hungry.pptx
Best Catering Event Planner  Miso-Hungry.pptxBest Catering Event Planner  Miso-Hungry.pptx
Best Catering Event Planner Miso-Hungry.pptx
Miso Hungry
 
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques SupplierAll Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
Trophy-World Malaysia Your #1 Rated Trophy Supplier
 
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
gitapress3
 
Maximizing Efficiency with Integrated Water Management Systems
Maximizing Efficiency with Integrated Water Management SystemsMaximizing Efficiency with Integrated Water Management Systems
Maximizing Efficiency with Integrated Water Management Systems
Irri Design Studio
 
Hospitality Training for Hotel Industries
Hospitality Training for Hotel IndustriesHospitality Training for Hotel Industries
Hospitality Training for Hotel Industries
VanieTAnggita
 
Top Email Marketing Trends to Watch in 2024
Top Email Marketing Trends to Watch in 2024Top Email Marketing Trends to Watch in 2024
Top Email Marketing Trends to Watch in 2024
time4servers technologies
 
Delightful Finds: Unveiling the Power of Gifts Under 100
Delightful Finds: Unveiling the Power of Gifts Under 100Delightful Finds: Unveiling the Power of Gifts Under 100
Delightful Finds: Unveiling the Power of Gifts Under 100
JoyTree Global
 
How Does Littering Affect the Environment.
How Does Littering Affect the Environment.How Does Littering Affect the Environment.
How Does Littering Affect the Environment.
ClenliDirect
 

Recently uploaded (20)

Elevate Your Brand with Digital Marketing for Fashion Industry
Elevate Your Brand with Digital Marketing for Fashion IndustryElevate Your Brand with Digital Marketing for Fashion Industry
Elevate Your Brand with Digital Marketing for Fashion Industry
 
Are Gutters Necessary? Explore the details now!
Are Gutters Necessary? Explore the details now!Are Gutters Necessary? Explore the details now!
Are Gutters Necessary? Explore the details now!
 
WORK PERMIT IN BULGARIA | Work Visa Services
WORK PERMIT IN BULGARIA | Work Visa ServicesWORK PERMIT IN BULGARIA | Work Visa Services
WORK PERMIT IN BULGARIA | Work Visa Services
 
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docxIslamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
Islamabad No 1 Amil Baba In Pakistan amil baba kala ilm.docx
 
Colors of Wall Paint and Their Mentally Properties.pptx
Colors of Wall Paint and Their Mentally Properties.pptxColors of Wall Paint and Their Mentally Properties.pptx
Colors of Wall Paint and Their Mentally Properties.pptx
 
Reliable Logistics Solutions - Truxcargo
Reliable Logistics Solutions - TruxcargoReliable Logistics Solutions - Truxcargo
Reliable Logistics Solutions - Truxcargo
 
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
The Jamstack Revolution: Building Dynamic Websites with Static Site Generator...
 
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
Unlocking Insights: AI-powered Enhanced Due Diligence Strategies for Increase...
 
The Best Premium IPTV Service Frane.docx
The Best Premium IPTV Service Frane.docxThe Best Premium IPTV Service Frane.docx
The Best Premium IPTV Service Frane.docx
 
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROLSECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
SECUREX UK FOR SECURITY SERVICES AND MOBILE PATROL
 
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
BesT panDit Ji LoVe problem solution 9463629203 UK uSA California New Zealand...
 
Chandigarh call garal serives 9512450098
Chandigarh call garal serives 9512450098Chandigarh call garal serives 9512450098
Chandigarh call garal serives 9512450098
 
Best Catering Event Planner Miso-Hungry.pptx
Best Catering Event Planner  Miso-Hungry.pptxBest Catering Event Planner  Miso-Hungry.pptx
Best Catering Event Planner Miso-Hungry.pptx
 
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques SupplierAll Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
All Trophies at Trophy-World Malaysia | Custom Trophies & Plaques Supplier
 
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
BEst VASHIKARAN SPECIALIST 9463629203 in UK Baba ji Love Marriage problem sol...
 
Maximizing Efficiency with Integrated Water Management Systems
Maximizing Efficiency with Integrated Water Management SystemsMaximizing Efficiency with Integrated Water Management Systems
Maximizing Efficiency with Integrated Water Management Systems
 
Hospitality Training for Hotel Industries
Hospitality Training for Hotel IndustriesHospitality Training for Hotel Industries
Hospitality Training for Hotel Industries
 
Top Email Marketing Trends to Watch in 2024
Top Email Marketing Trends to Watch in 2024Top Email Marketing Trends to Watch in 2024
Top Email Marketing Trends to Watch in 2024
 
Delightful Finds: Unveiling the Power of Gifts Under 100
Delightful Finds: Unveiling the Power of Gifts Under 100Delightful Finds: Unveiling the Power of Gifts Under 100
Delightful Finds: Unveiling the Power of Gifts Under 100
 
How Does Littering Affect the Environment.
How Does Littering Affect the Environment.How Does Littering Affect the Environment.
How Does Littering Affect the Environment.
 

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