The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

Communicating Information: Web Design. It’s a big net HTTP FTP TCP/IP SMTP protocols The Internet The Internet is a network of networks… It connects millions.
11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
Introduction to Web Interface Technology (CSE2030)
1 Software Testing and Quality Assurance Lecture 32 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
IST 221 Internet Concepts and Applications Internet, WWW and HTML 1.
Session Management A290/A590, Fall /25/2014.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Application Layer Functionality and Protocols Network Fundamentals – Chapter.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
IT 210 The Internet & World Wide Web introduction.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Server-side Scripting Powering the webs favourite services.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Advanced Web Forms with Databases Programming Right from the Start with Visual Basic.NET 1/e 13.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CSE 154 LECTURE 12: COOKIES. Including files: include include("filename"); PHP include("header.html"); include("shared-code.php"); PHP inserts the entire.
ITIS 1210 Introduction to Web-Based Information Systems Chapter 23 How Web Host Servers Work.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
Chapter 1: The Internet and the WWW CIS 275—Web Application Development for Business I.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
STATE MANAGEMENT.  Web Applications are based on stateless HTTP protocol which does not retain any information about user requests  The concept of state.
Jsp (Java Server Page) Is a server side program.
CS1001 Lecture 9. Overview Security Security HTML HTML.
Introduction to JavaScript CS101 Introduction to Computing.
TCP/IP (Transmission Control Protocol / Internet Protocol)
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
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.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
ASP.NET WEB Applications. ASP.NET  Web application framework developed by Microsoft  Build dynamic data driven web applications and web services  Subset.
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.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
National College of Science & Information Technology.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Tonga Institute of Higher Education IT 141: Information Systems
Section 6.3 Server-side Scripting
WWW and HTTP King Fahd University of Petroleum & Minerals
PHP / MySQL Introduction
Client side & Server side scripting
Tonga Institute of Higher Education IT 141: Information Systems
The Client Server Model
Tonga Institute of Higher Education IT 141: Information Systems
The Client Server Model
Lecture 14: JSON and Web SERVICES
5/6/2019 Session 8.2 Postback, ViewState
Computer Networks Protocols
Presentation transcript:

The Problem of State

We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX Page (Web Form) How it is passed between browser and server The structure of the page How it provides functionality to the browser The problem of state

The Internet and TCP/IP Network of networks Defence research in the 60s TCP/IP (Transmission Control Protocol / Internet Protocol) Allows programs on computers to talk to each other

The IP Address Uniquely identifies each machine 32 bit number made up of four 8 bit numbers Visit Assigned in blocks G677 (my server)

Name Servers not obviously

Ports TCP/IP allows programs on machines to communicate IP address identifies machine port number identifies program There is no law that states a specific port must be used for a service however there are certain ports that traditionally provide services. 80 HTTP (web pages) 21 FTP (File transfers) 119 NNTP (Network News Transfer Protocol) 443 HTTPS (secure web pages)

The Good Old Days Up until about 1989 the Internet existed quite happily without the World Wide Web File Transfer Protocol (FTP) Telnet Usenet World Wide Web - Is not the internet!

The Web’s Client Server Model

Where is Client and Server in Visual Studio?

Server v Client Side Code Code may be added at either end of the process Client side code runs at browser Action Script (Flash) JavaScript VBScript Server Side Code ASP.NET (C # VB.NET) PHP JSP

Server Side Code – Dynamic Pages

HTML Forms GET and POST HTML allows simple form creation

HTML Form Code Change POST to GET

Active Server Pages (ASPX) Events & Handlers User triggered events ClickTriggered when a user presses a button Selected Index ChangedActivated when the user selects an item off a drop down list System generated LoadRuns when the ASPX page is loaded by the server UnloadRuns when the ASPX page is unloaded from the server

Create a Similar Form in ASP

Active Server Controls Note the tag <asp

Post Back = False Post back is false on the first HTTP request The browser sends the request to the server for the page The server runs the page load event The server runs page unload event ASPX controls converted to HTML and sent to the requesting browser

What the Browser Gets… ASP & Code never makes it to the browser!

Post Back = True The browser sends the HTTP request to the server The server runs the page load event The server runs other events (in this case the click event of the Go button) The server runs the page unload event All asp controls changed into suitable HTML controls and sent back to the requesting browser NOTE Load and Unload Events ALWAYS RUN!

The Problem of State We have seen the following points The web follows a client server mode of operation The ASPX page is rendered on the server and sent to the browser as HTML The page is rendered in two modes PostBack = False (The first time the page is requested, Load – Unload events) PostBack = True (Subsequent renderings of the page, Load – Other Events – Unload) The thing to note in all of this messing about is that the settings of the page are not automatically remembered on each round trip. The web is referred to as stateless. So how is this problem addressed?

Use Cookies Cookies are small files stored on the client computer that allow the web page to record details of its visit to that machine. Cookies may be turned off by the user of the client machine. Not suitable for sensitive data.

Use a Query String This is achieved by setting the HTML forms method to Get rather than Post. This is a good technique so long as the data isn’t a potential security risk. This would be a very bad query string. rd123

Use Session Variables Use in conjunction with IsPostBack in the Load Event of the page… Browser Server HTTP Request HTML Page Load session variables in the load event Save session variables in the unload event

Potential Problem… Remember the load event runs every time the page is processed and it is the first thing the server does. If we load the messages on subsequent renderings of the page we get the following problem… I click an entry in the list and press delete The load event runs re-setting the list removing my selection The delete click event fails because the list has been re-set To avoid this kind of problem we need to check IsPostBack to see if it is appropriate to read data at the server.

Summary Because the web is stateless and processes pages the way that it does you will at some point get very confused about state! Remember Load event runs first Other Events next Unload event last Load and Unload always run!