Introduction to ASP.NET

Slides:



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

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?
Introduction to ASP.NET
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
The Web Warrior Guide to Web Design Technologies
Building Applications using ASP.NET and C# / Session 1 / 1 of 21 Session 1.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Basics of ASP.NET. 2 © UW Business School, University of Washington 2004 Outline Installing ASP.NET and Web Matrix Data Types Branching Structure Procedures.
Web-Based Applications
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Introduction to ASP.Net ISYS 350. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
ASP.NET
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.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Introduction to ASP.NET
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
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.
HTML, GUI, ASP.NET Rina Zviel-Girshin Lecture 2
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Overview of Previous Lesson(s) Over View  Server controls are small building blocks of the graphical user interface, which includes  Text boxes  Buttons.
Chapter 1: Introduction to Web
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Microsoft Visual Basic 2005: Reloaded Second Edition
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
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.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
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.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
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.
Overview of Previous Lesson(s) Over View  SDI programs  The Application Wizard can generate single-document interface (SDI) applications that work.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Module 1: Working with ASP.NET. Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs.
Compunet Corporation1 Programming with Visual Basic.NET Fundamentals of Programming Lecture # 1 Tariq Ibn Aziz.
PAGE DIRECTIVES. Page Directives  They are instructions, inserted at the top of an ASP.NET page, to control the behavior of ASP.NET pages.  So it is.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
Introduction to ASP.NET What is ASP.NET and how is different from ASP –ASP: server side technology for creating dynamic web pages using scripting languages.
Introduction and Principles Web Server Scripting.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
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.
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 WEB Applications. ASP.NET  Web application framework developed by Microsoft  Build dynamic data driven web applications and web services  Subset.
Sergey Sidorov PhD student, computer software chair Computer Science department.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
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.
ASP.NET Forms.
Web Forms, HTML, and ASP.NET
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

Introduction to ASP.NET

Chapter Objectives

Static and Dynamic Web Applications Static Web pages Created with HTML controls Dynamic Web pages Allow user to interact with the Web page Changes appearance or content Created with Microsoft’s Active Server Pages .NET (ASP.NET) Used to build server-side Web applications

Processing a Request for a Web Page

ASP.NET Main ASP.NET applications Web Forms Web Services Used to process forms and develop cross-browser applications Uses .aspx file extension Web Services Other applications can interact with your program Uses .asmx file extension

Web Forms ASP.NET pages within an ASP.NET application 2 logical areas: Identified with file extension .aspx 2 logical areas: HTML template Contains design layout, content, and controls Collection of code commonly located behind Web Form

HTML Server Controls Similar to HTML controls except processed by server Write runat=“server” to transform HTML control into HTML Server control Controls have closing tag, or end with /> HTML control: <input type=“text”> HTML Server control: <input type=“radio” runat=“server” value=“Yes”/> Yes

ASP.NET Server Controls Creates HTML code ASP.NET controls usually identified with prefix asp: followed by name of the control Types of ASP.NET Server Controls ASP.NET Form Controls (Web controls) Data Validation Controls User Controls Mobile Controls

HTML Server Versus ASP.NET Server Controls ASP.NET form controls also have different properties than their HTML server control counterparts HTML Server label control Message1.InnerHTML = "Product 1" ASP server label control Message2.Text = "Product 2"

Browser Source Code Look at the browser’s source code for each ASP.NET page to understand what the Web server is sending to the browser ASP.NET code is never sent to the browser Only HTML tags, along with client-side scripts, are sent to the browser Many errors are related to the syntax of the HTML that is sent to the browser, such as a missing closing tag, or a missing quotation mark You can quickly locate HTML syntax errors

Server Controls within Visual Studio .NET

Code Behind the Page Written in an ASP.NET-compatible language File extension is .vb if code is written in Visual Basic .NET Compiled code behind the page is the class definition for the page When you build the application, you compile the code into an executable file stored in the bin directory

The Code Behind the Page

Postback Posting back data into form The _ViewState hidden form field Very long encoded string Contains information required to maintain form data across multiple page requests Value changes each time form is reposted EnableViewState property Turns postback feature on or off. To turn off: <%@ Page EnableViewState="false" %>

Postback data using the _ViewState hidden field

Page Class Events The first time a page is requested by a client, a series of page events occurs Page_Init – initializes page control hierarchy Page_Load – loads any server controls into memory and occurs every time page is executed Server control events – action and change events occur when page is posted back to the server Page_PreRender – occurs immediately before control hierarchy is rendered and sent to the browser Page_Unload –removes page from server’s memory

Page Class Event Cycle

Page_Load Event Procedure Begin procedure with keyword Sub End procedure with keywords End Sub Sub Page_Load(s As Object, e As EventArgs) Message.InnerHtml = “Welcome!” End Sub

Server Control Events When user clicks the button, an OnServerClick event handler is called <input type= "button" Value= "Click Me!" id="MyBtn" runat="server" OnServerClick="MyBtn_Click"> Client side onClick triggers event that returns a server click event <button language = "javascript" onClick="_doPostback('MyBtn',‘ ')" id="MyBtn" "Click Me!“ </button>

Interacting with the Code Behind the Page

Server Control Events (continued) Code behind the page sends a message back to the browser Sub MyBtn_Click(sender As Object, E as EventArgs) Message.InnerHtml = "You clicked me! " End Sub

Trace Property View Server controls and Server variables On the first line in the HTML template enter <%@ Page Trace = "true" %> Control Tree ID represents property of the control Controls with no name are assigned an ID Non-server controls are assigned as a Literal control

The Page Class Control Tree

Page.Request Property HTTP header packet contains information about the HTTP request User agent is used to identify the client software Request object retrieves header information as server variables Request.UserHostAddress (client IP address) Request.Browser.Browser (browser name)

Page.Request Property (continued) Request property contains a Form collection and QueryString collection that allow you to collect form information from both methods

QueryString If form method is GET, form is sent appended to the URL requested as a single string called the QueryString Separated from URL with question mark (?) http://www.tarastore.com/index.asp?name=katie&topic=asp

Retrieving Form Values from the QueryString Collection Sample form field <input id="PWD" type="password" size="8" runat="server"> Querystring http://www.tarastore.com/index.aspx?PWD=MyPassword Retrieve the password Request.QueryString("PWD")

Retrieving Form Values from the Form collection If the form method is POST, it is sent as part of the HTTP request body Request.Form("PWD")

Direct Access to Form Values A simpler method to retrieve the value from a form field is to directly access the value properties of the form field If (PWD.Value = "Course") Then Message.InnerHtml = "Welcome!" Else Message.InnerHtml = "Try again!" End If

Retrieving Form Values and Server Variables

Page.Response Property Response.Write(string) Writes the value of the string to the Web page Response.Write("Copyright by TaraStore<br/>") Response.WriteFile(file path) Sends the entire contents of a text file to the Web page Response.WriteFile("c:\copyright.txt")

Page.Response Property (continued) Response.Redirect(URL) Sends the browser to another page Response.Redirect("http://www.course.com/")

Locating Your ASP.NET Application Web Server is called Internet Information Server C:/Inetpub/wwwroot maps to http://localhost/ Develop on local Web server or test server Deploy Web application to production Web server on the Internet You can transfer Web application files using File Transfer Programs (FTP)

Web Services Exposes part of a program over the Internet Web Service file has .asmx file extension Uses open standards so it’s supported across applications and platforms Used to create business-to-business applications Can share data with other partners

The Tara Store Web Service

The .NET Framework An architectural model for creating programs that interface with the operating system and base class libraries Contains a hierarchical set of Base Class Libraries Base class libraries are code libraries that provide general functions

The .NET Framework

Namespaces Organizes base class libraries Top namespace is System All Web Forms inherit the System.Web.UI namespace System.Web.UI contains classes for controls used on Web Forms HTML Server controls ASP.NET Server controls (Web controls)

The HTML Server controls

The ASP.NET Server controls

Common Language Runtime Each .NET language compiles into a common intermediate language and common type system Assembly contains compiled .NET program The compiled .NET program contains the intermediate language and metadata Metadata describes the assembly contents

Building the application

IL Disassembler (ILDASM) View assembly using ILDASM Displays intermediate language Can view information about namespaces, classes, and other programming structures

Using the ILDASM

Other Resources Sample Web Sites Developer Resources http://www.ibuyspy.com/ibs_store/ http://www.asp.net/CommerceStarterKit/ Developer Resources www.asp.net QuickStart Web site localhost/quickstart/ samples.gotdotnet.com/quickstart

Summary ASP.NET pages can contain programs written in a variety of programming languages. Web Forms end in .aspx. Web Services end in .asmx. User controls end in .ascx. The term “ASP.NET pages” and “Web Forms” are synonymous. The entire ASP.NET Web page is a class called the Page class. The .NET framework is the architectural framework in which ASP.NET applications are created.

Summary (continued) Web Services allow you to expose a program interface publicly to other businesses and applications. At compile time, all languages must support the same common .NET data types. Page class renders HTML and Server code to the browser. The Page class contains the code behind the page, which is located in a separate file. You need a Web server to post your pages and a platform that supports the .NET Framework. There are a variety of help resources within Visual Studio .NET and on the Internet.