1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
XP Browser and Basics1. XP Browser and Basics2 Learn about Web browser software and Web pages The Web is a collection of files that reside.
JavaScript Forms Form Validation Cookies CGI Programs.
Servlets and a little bit of Web Services Russell Beale.
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Session Management A290/A590, Fall /25/2014.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Browser and Basics Tutorial 1. Learn about Web browser software and Web pages The Web is a collection of files that reside on computers, called.
Chapter 10 Maintaining State Information Using Cookies.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
 A cookie is a piece of text that a Web server can store on a user's hard disk.  Cookie data is simply name-value pairs stored on your hard disk by.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Cookies Set a cookie – setcookie() Extract data from a cookie - $_COOKIE Augment user authentication script with a cookie.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.
JavaScript, Fourth Edition
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Session tracking There are a number of problems that arise from the fact that HTTP is a "stateless" protocol. In particular, when you are doing on- line.
Web Application Development * These slides have been adapted and modified from CoreServlets course material (Marty Hall) and LUMS cs391 (Umair Javed).
Website Development with PHP and MySQL Saving Data.
Cookies Web Browser and Server use HTTP protocol to communicate and HTTP is a stateless protocol. But for a commercial website it is required to maintain.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
ITCS373: Internet Technology Lecture 5: More HTML.
STATE MANAGEMENT.  Web Applications are based on stateless HTTP protocol which does not retain any information about user requests  The concept of state.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Saving State on the WWW. The Issue  Connections on the WWW are stateless  Every time a link is followed is like the first time to the server — it has.
Sessions and Cookies State Management, Cookies, Sessions, Hidden Fields SoftUni Team Technical Trainers Software University
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
Session Tracking Parts of this presentation was provided by SSE.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
8-Mar-16 More About Servlets Session Tracking. Persistent information A server site typically needs to maintain two kinds of persistent (remembered) information:
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
HTTP Transactions 1. 2 Client-Server Model 3 HTTP HyperText Transport Protocol Native protocol for WWW Sits on top of internet’s TCP/IP protocol HTTP.
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
Distributed Web Systems Cookies and Session Tracking Lecturer Department University.
Managing State Chapter 13.
How to Write Web Forms By Mimi Opkins.
Web Software Model CS 4640 Programming Languages for Web Applications
Introducing Forms.
Client / Session Identification Cookies
Session Tracking Techniques
Hyper Text Transfer Protocol
Building ASP.NET Applications
PHP-II.
Presentation transcript:

1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The server cannot uniquely identify each user, therefore cannot implement user-defined preferences. A session is a persistent network connection between two hosts, for example, a client and a server, to exchange information. An HTTP session is a virtual connection between the client and host. A typical HTTP transaction involves: –The client establishes a connection to the server. –The client issues a request to the server. –The client receives a response. –The connection is closed.

2 A virtual connection associated each request with the client that issued it. It is required that each client returns a piece of state information (session id or user id) with each request. The server uses the session id to uniquely identify each user and it with client’s previous requests. A virtual connection, therefore, maintains the state and client identity across multiple requests (all sharing the same session ID). An HTTP session may expire after a period of inactivity.

3 State Management is the ability to maintain a client’s current state by passing the client-specific information with each request, for example, user’s preferences for a background color.. A server may not uniquely identify the client’s identity. Session Management maintains both state and identity. The association in a session management exists for a period of time between a client a server across multiple requests.

4 Session Management Storing session Information in the URL Path. Rewritten URLs and hidden Variables Cookies

5 Storing Information in the URL Path Storing Session Information in the URL Path –Server sends state information to the client. –The client returns the state information with each request. –The session ID is embedded in the URL path. –The following sequence of actions take place: The client requests a document at - is a HTML form for user’s login name and password. When a valid user’s name and password are received, the server generates a unique session id and redirects the client to htm

6 The server parses the path portion of all requested URLs for a valid session id. From this point onwards, the hyperlinks within all documents returned to the client will use only relative URLs. The browser automatically fills in the missing protocol, host and path information along with the session Id. This feature will work with all browsers (including those that do not support cookies.

7 Rewritten URLs Rewritten URLs pass state info. Between the client and the server by embedding information in the URL of all hyperlinks within an HTML document. An example scenario: 1. The server presents the client with a form to choose the background color. Please select a background color BLUE GREEN

8 Rewritten URLs 2.The color preference is transmitted between the client and the server with each request. The HTML form below is returned to the client <!– background is blue Please select from the list below Book Catalog Search The site The server added the query string bcolor=blue to every hyperlink in the document.

9 Rewritten URLs Instead of storing a client’s preference, a Session Id can be used in place of preference, for session management. Rewritten URLs are effective only when the client follows a hyperlink. If the form is submitted without following the hyper link, the state/session information is not passed to the server.

10 Hidden Variables Hidden variables in an HTML form operate like other input fields (Text fields, check boxes, radio buttons) and transmit information as name/value pairs. The hidden fields are not visible to the to the client (hence cannot modify). Hidden variables work only when the client submits the HTML form.

11 Example 1. The server presents the client with a form to choose the background color. BLUE NAME=“bcolor”VALUE=“blue” … 2. On receiving the HTML form, the server extracts the value of bcolor and constructs the next HTML page and sets the background to blue. The color preference is stored in a hidden variable in the document. <FORM ACTION=“SomeServlet” METHOD=POST Please enter your last name <INPUT TYPE=“TEXT” NAME=“name” SIZE=“25”

12 Rewritten URLs and Hidden variables It is sometimes necessary to use both rewritten URLs and hidden variables to maintain state and session with HTTP. All hyperlinks will contain session ID. All HTML forms will contain hidden variables with Session ID.

13 Using Rewritten URLs and Hidden Variables A typical scenario of events: –The user requests a page from a web-site. –The server returns an HTML form prompting the user to enter his/her name and address and preferred background color. The HTML form contains a hidden variable that holds a session ID for this client. –The user completes the form and clicks the submit button. –The user’s input is sent to the server along with the session id. –The server extracts the user’s name, address and color preference and session id from the request and stores them in a DB. –An HTML document containing the same session id is stored in all hidden fields and URL’s for all hyperlinks

14 Cookies Cookies offer a mechanism to store state information on the client. The server instructs the client to store some amount of state information. The information stored at the client is returned to the server with each request. Advantages: –It is not necessary to return the session information to the client as is necessary with rewritten URLs and hidden variables. –Do not require the parsing of the requested URL. –Cookie information is extracted from the client request using simple Servlet API methods.