Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.

Slides:



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

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
Building Applications using ASP.NET and C# / Session 1 / 1 of 21 Session 1.
Anatomy of an ASP.NET Page. Slide 2 My Version of the Big Picture (1) ASP Worker (Engine) Your application Runs Server Other applications User 1User 2.
Web server (serves web pages).NET Framework (executes code) ASP.NET processor Internet Information Services Server HTTP requestASP.NET code OutputHTML.
Web-Based Applications
Chapter 1: An Introduction To ASP.NET Web Programming
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Chapter 9 Web Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
DR.JOHN ABRAHAM PROFESSOR UTPA ASP.NET. ACTIVE SERVER PAGES (ASP) Web application development environment Web applications use web browser to display.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Object-Oriented Application Development Using VB.NET 1 Chapter 12 Web Forms, HTML, and ASP.NET.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Server-side Scripting Powering the webs favourite services.
With your friendly Web Developer, Chris.. Terminology  HTML - > Hypertext Markup Language  CSS -> Cascading Style Sheet  open tag  close tag  HTTP->Hypertext.
.Net is a collection of libraries, templates and services designed to make programming applications of all kinds, easier, more flexible (multi platform),
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
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.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
ASP.NET application. Roadmap ASP.NET file types Bin directory Application updates Simple application from start to finish using a virtual directory Behind.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
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.
Christopher M. Pascucci Basic Structural Concepts of.NET Managing State & Scope.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Anatomy of an ASP.NET Page. Slide 2 Compiling an ASP.NET Page An ASP.NET page is compiled when it is rendered for the first time A page is compiled to.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Maintaining Application State MIS3502: Application Integration and Evaluation Paul Weinberg Presentation by David Schuff.
Christopher M. Pascucci.NET Programming CodeBehind.
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.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
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.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
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.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
PostBack  When an initial request for a page (a Web Form) is received by ASP.NET, it locates and loads the requested Web Form (and if necessary compiles.
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.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
ASP.NET Architecture Mike Taulty Developer & Platform Group Microsoft Ltd
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Murach's ASP.NET 4.5/VB, C5© 2013, Mike Murach & Associates, Inc.Slide 1.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
© 2016, Mike Murach & Associates, Inc.
Computing with C# and the .NET Framework
ASP.NET Forms.
ASP.NET Web Controls.
© 2016, Mike Murach & Associates, Inc.
Web Forms, HTML, and ASP.NET
© 2016, Mike Murach & Associates, Inc.
Unit 27 - Web Server Scripting
Anatomy of an ASP.NET Page
Chapter 9 Programming with Web Forms
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 2

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 3

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 4

Terminology (1)  Dynamic web pages  Web application  Web page  Web form  Client/server application  Clients and Servers  HTTP – HyperText Transfer Protocol  Web servers and Web browsers  Round trip Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 5

Terminology (2)  IIS  HTML  HTML document  HTML Request  HTMLResponse  Postback  URL  Render  aspx Code Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 6

Terminology (3)  State and stateless protocol  Session  Session state object  Session ID  Application  Application state  Application state object  Assembly  Code behind  Page directives  ASP – Active Server Pages Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 7

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 8

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 9

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 10

Dynamic Vs Static Web Pages  What’s the difference?  Handling static pages (HTML documents) like mine is comparatively simple  HTTP request  HTTP response  pages in addition to aspx – e.g., php © 2006, Mike Murach & Associates, Inc. Slide 11

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 12

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 13

Processing a Dynamic Web Page Request: The Round Trip  Dynamic web page – HTML document generated by a web form. The process goes like this …  Page request – web server looks up the extension in its list of application mappings  If.aspx, the file is passed on to ASP.NET for processing (things get interesting and complex)  ASP.NET is an Application Server (there are others, such as for PHP etc)  ASP.NET runs the web form, generating a pure HTML document  Server  browser  From client to server to client: round trip Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 14

Processing a Dynamic Page Request  This request – response sequence is called a round-trip  At the end of a round-trip the Server Application ends and its state is lost  This is important as we shall see – saving state  Once browser has the form at the client machine the user can make changes  Clicking buttons, typing text, drop down selections etc  Page then sent back to the Server (postback) Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 15

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 16

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 17

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 18

State Concepts  State refers to the data maintained by an application for a single user.  Includes variables (reference and value) and control properties and values  An application must maintain a separate state for each user.  HTTP doesn’t keep track of state between round trips so the web application authors (YOU) must.  HTTP is a stateless protocol. Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 19

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 20

View State Concepts  View state maintains the value of form control properties (but not of any variables used in processing the form)  In other words, your basic form remains in tact  View state is implemented by default. Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 21

Session State Concepts  For each user, ASP.NET creates a session state object that contains a session ID.  The session ID is passed from the server to the browser and back to the server.  The session state object is kept on the server.  To maintain session state across an application (for a single user), you can add program variable and control property values to the session state object to save them across server applications (round trips) © 2006, Mike Murach & Associates, Inc.Slide 22

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 23 Application State Concepts

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 24 The New Profile Feature of ASP.NET 4.0

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 25

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 26

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 27

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 28

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 29

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 30

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 31

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 32

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 33

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 34

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 35

How an ASP.NET Application Works  Refer to the figure on the next slide   It is a web form (an Order form in this case)  It is being viewed in design form  There is a lot of “stuff” behind this form  We have to learn about this “stuff”  Note the similarities here between a web form page and your windows forms pages.  Also note the differences the smart tag arrow and drop down menu that shows up when you access that arrow Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 36

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 37

Web Forms and Windows Forms – A Few Differences using VB 2010  Solution Explorer provides two directories:  App_Code App_Data (usually a database)  ASP.NET keeps two files for a form – both files are generated as you build your form  aspx file – holds HTML code and asp tags for server controls  aspx.vb – holds VB.NET code-behind  The smart tag arrow and drop down menu that shows up when you access that arrow Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 38

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 39

Dissecting the Order.aspx Form (see Slide 8 & 44)   Page directive has four attributes  Specifies code behind file  Indicates the Order.aspx class inherits Order class (note use of verb inherit – the aspx code inherits the vb code)  Content of web page defined within div tags  asp tags define server controls  They and the form are processed at server  Converted to HTML and returned to browser (rendered)  Postback - page must be posted back to server  Automatically happens for button controls  Must be specified for other controls Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 40

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 41

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 42

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 43

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 44

Dissecting the Order (Code-Behind)   The file name is Order.aspx.vb  Partial classes have to be combined with other partial classes in order to compile (where are the declarations for the controls???)  Load event raised each time a page is loaded  Each time a page is requested, ASP.NET initializes it (hidden) and raises the load event  Page properties: IsPostback, Response, Session, etc  DataBind – if initial page load bind ddl to a list If Not IsPostBack Then ddlProducts.DataBind() Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 45

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 46

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 47

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 48

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 49

Processing an ASP.NET Application (A)  Complicated – lots of compilations  Order.aspx and Order.aspx.vb are generated normally in design mode as you drag and drop controls etc (see Chapter 2)  1. Whenever a web page is requested (through a web-server such as IIS), IIS looks at the extension for the page and figures out which Application Server should process the page (In our case it will be ASP.NET).  2. ASP.NET reads the aspx file for the page and generates a class ( Order_aspx ) and a partial class ( Order) which contains the declarations for the form and its controls  3. The two partial classes ( Order, Order.aspx.vb ) and are compiled together and provide all the event handling needed for the entire page (yields the Order class dll) Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 50

Processing an ASP.NET Application (B)   4. An Order_aspx file is generated by ASP.NET and compiled to another dll.  It contains all the code needed to initialize the given web page  Inherits the Order class – so any object instan-tiated from the Order_aspx class will contain  the code that creates the web page  the event handlers provided by the Order class  5. VB compiler is called to compile class files in the App_Code file producing another dll Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 51

Processing an ASP.NET Application (C)   FINALLY – ASP.NETcreates an instance of the page and raises appropriate events  The events are processed by the event handlers for the page  HTML is generated and the page is rendered  To complete the round trip, the HTML page is passed back to the web server and on to the client side browser  Note that all dlls ( steps 1-4 ) are generated only the first time a page is called. They are cached. Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc. Slide 52

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 53

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 54

Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 55