Web Application Development Introduction. Lesson: Creating Web Forms What is a Web Form? Creating a Web Form with Visual Studio.NET.

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.
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.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
Introduction to ASP.NET
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
JavaScript & jQuery the missing manual Chapter 11
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
HTML, GUI, ASP.NET Rina Zviel-Girshin Lecture 2
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Introduction to ASP.NET 1www.tech.findforinfo.com.
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.
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.
1 CS 3870/CS 5870 Note04 Session Variables and Post Back.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 2 : Creating a Microsoft ASP.NET Web Form.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
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,
Module 7: Creating a Microsoft ASP.NET Web Application.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes across a network.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Session 4: HTML and Web Server Controls. Outline Creating Web Forms Using Server Controls HTML Server Controls Web Server Controls Writing ASP Code Inline.
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.
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview VITALE, CATURANO & COMPANY LTD SharePoint Developer Series – Web Part.
Christopher M. Pascucci.NET Programming CodeBehind.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
Understand Configuration Files Web Development Fundamentals LESSON 1.6.
Introducing ASP+ Scott Mitchell
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services.
Module 4: Creating a Web Application with Web Forms
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
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.
Svetlin Nakov Telerik Corporation
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.
Sergey Sidorov PhD student, computer software chair Computer Science department.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
ASP.NET Architecture Mike Taulty Developer & Platform Group Microsoft Ltd
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
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 6: The User Interface (UI) Dave.
Computing with C# and the .NET Framework
Session Variables and Post Back
Active Server Pages ASP.Net
Application Infrastructure
Module 10: Creating a Web Application with Web Forms
Presentation transcript:

Web Application Development Introduction

Lesson: Creating Web Forms What is a Web Form? Creating a Web Form with Visual Studio.NET

What Is a Web Form?.aspx extension Page Page directive Body attributes Form attributes

Creating a Web Form with Visual Studio.NET New ASP.NET Web Applications create a default Web Form: WebForm1.aspx Create additional Web Forms from the Solution Explorer

Lesson: Using Server Controls What is a Server Control? Types of Server Controls Saving View State Demonstration: Converting HTML Controls to Server Controls HTML Server Controls Web Server Controls Practice: Identifying the HTML Generated by Web Server Controls Selecting the Appropriate Control Demonstration: Adding Server Controls to a Web Form

What is a Server Control? Runat="server" Events happen on the server View state saved Have built-in functionality Common object model All have Id and Text attributes Create browser-specific HTML <asp:Button id="Button1" runat="server" Text="Submit"/> <asp:Button id="Button1" runat="server" Text="Submit"/>

Types of Server Controls HTML server controls Web server controls Intrinsic controls Validation controls Rich controls List-bound controls Internet Explorer Web controls

Saving View State Hidden ViewState control of name-value pairs stored in the Web Form On by default, adjustable at Web Form and control level

HTML Server Controls Based on HTML elements Exist within the System.Web.UI.HtmlControls namespace

Web Server Controls Exist within the System.Web.UI.WebControls namespace Control syntax HTML that is generated by the control <asp:TextBox id="TextBox1" runat="server">Text_to_Display <asp:TextBox id="TextBox1" runat="server">Text_to_Display <input name="TextBox1" type="text" value="Text_to_Display" Id="TextBox1"/> <input name="TextBox1" type="text" value="Text_to_Display" Id="TextBox1"/>

You need specific functionality such as a calendar or ad rotator The control will interact with client and server script You are writing a page that might be used by a variety of browsers You are working with existing HTML pages and want to quickly add ASP.NET Web page functionality You prefer a Visual Basic-like programming model You prefer an HTML-like object model Use Web Server Controls if: Use HTML Server Controls if: Bandwidth is not a problemBandwidth is limited Selecting the Appropriate Control

Lesson: Using Code-Behind Pages How to Implement Code What are Code-Behind Pages?

How to Implement Code Three methods for adding code: Put code in the same file as content (mixed) Put code in a separate section of the content file (inline code) Put code in a separate file (code-behind pages) Code-behind pages are the Visual Studio.NET default

What are Code-Behind Pages? Separation of code from content Developers and UI designers can work independently Form1.aspxForm1.aspx Form1.aspx.vb Form1.aspx.vb or Form1.aspx.cs code code Separate filesSingle file

Lesson: Adding Event Procedures to Web Server Controls What are Event Procedures? Client-Side Event Procedures Server-Side Event Procedures Creating Event Procedures Interacting with Controls in Event Procedures

What are Event Procedures? Action in response to a user’s interaction with the controls on the page

Client-Side Event Procedures Internet.HTM Pages Typically, used only with HTML controls only Interpreted by the browser and run on the client Does not have access to server resources Uses

Server-Side Event Procedures Used with both Web and HTML server controls Code is compiled and run on the server Have access to server resources Use or Internet.ASPX Pages

Creating Event Procedures Visual Studio.NET declares variables and creates an event procedure template Using the Handles keyword adds many event procedures to one event protected System.Web.UI.WebControls.Button cmd1; private void InitializeComponent() { this.cmd1.Click += new System.EventHandler(this.cmd1_Click); this.Load += new System.EventHandler(this.Page_Load); } private void cmd1_Click(object s, System.EventArgs e) protected System.Web.UI.WebControls.Button cmd1; private void InitializeComponent() { this.cmd1.Click += new System.EventHandler(this.cmd1_Click); this.Load += new System.EventHandler(this.Page_Load); } private void cmd1_Click(object s, System.EventArgs e) Protected WithEvents cmd1 As System.Web.UI.WebControls.Button Private Sub cmd1_Click(ByVal s As System.Object, _ ByVal e As System.EventArgs) Handles cmd1.Click Protected WithEvents cmd1 As System.Web.UI.WebControls.Button Private Sub cmd1_Click(ByVal s As System.Object, _ ByVal e As System.EventArgs) Handles cmd1.Click

Interacting with Controls in Event Procedures Read the properties of Web server controls Output responses to other Web server controls lblGreeting.Text = "new text" strGreeting = "Hello " & txtName.Text strGreeting = "Hello " + txtName.Text; lblGreeting.Text = "new text";

Lesson: Using Page Events Understanding the Page Event Life Cycle Handling Page.IsPostback Events

Understanding the Page Event Life Cycle Page_Load Page_Unload Textbox1_Changed Button1_Click Page is disposed Page_Init Control events Change Events Action Events

Handling Page.IsPostback Events Page_Load fires on every request Use Page.IsPostBack to execute conditional logic Page.IsPostBack prevents reloading for each postback Private Sub Page_Load(ByVal s As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then 'executes only on initial page load End If 'this code executes on every request End Sub Private Sub Page_Load(ByVal s As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then 'executes only on initial page load End If 'this code executes on every request End Sub private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // executes only on initial page load } //this code executes on every request } private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // executes only on initial page load } //this code executes on every request }

Lesson: Overview of Using XML Web Services What is an XML Web Service? Why use XML Web Services? Finding an XML Web Service

What is an XML Web Service? Programmable logic accessible by standard Web protocols Allows applications to send and receive information across the Internet Language, protocol, and platform independent Stateless architecture Can be asynchronous Based on an evolving W3C standard

Why Use XML Web Services? Internet Weather XML Web Service Exchange Rate XML Web Service Exchange Rate XML Web Service Pick your destination: The weather Forecast calls for: The exchange rate is: We can fly you there for only: Rain Redmond $1.56 $1, Airfare Database Airfare Database Airfare XML Web Service Airfare XML Web Service Northwind Traders Travel Site

Publish XML Web service URL and description Finding an XML Web Service.disco.wsdl Web Service Proxy Web Form UDDI Discover XML Web service Locate XML Web service URL Read.wsdl description Bind XML Web Service to Proxy Call XML Web Service from the Web Form by Proxy 66

Lesson: Using a Proxy to Call an XML Web Service Using Proxies to Call XML Web Services How to Use a Proxy to Call an XML Web Service XML Web Service Error Handling

Using Proxies to Call XML Web Services Appear the same as the original class, but do not contain application logic Use SOAP to interact with the XML Web Service Created from the ServiceName.asmx.wsdl file Add members to manage interactions with the XML Web service and support asynchronous calls Internet XML Web Service Proxy Web Form SOAP

How to Use a Proxy to Call an XML Web Service 1.Create a Web reference for the XML Web Service 2.Create an instance of the XML Web Service 3.Call the Web methods of the XML Web Service 4.Build the ASP.NET Web Application Sub Button1_Click(s As Object, e As EventArgs)... Dim ProxyGetStocks As New _ GetStocks.localhost.Service1() lblResults.Text = _ ProxyGetStocks.GetRating("Contoso") End Sub Sub Button1_Click(s As Object, e As EventArgs)... Dim ProxyGetStocks As New _ GetStocks.localhost.Service1() lblResults.Text = _ ProxyGetStocks.GetRating("Contoso") End Sub C# Code Example

XML Web Service Error Handling Service unavailable SOAP exceptions from XML Web Services GetStocks.StockWebRef.Service1 ProxyGetStocks = new GetStocks.StockWebRef.Service1(); ProxyGetStocks.Timeout = 10000; try { lblMessage.Text = ProxyGetStocks.GetRating(TextBox1.Text); } catch (Exception err) { lblMessage.Text = err.Message; } GetStocks.StockWebRef.Service1 ProxyGetStocks = new GetStocks.StockWebRef.Service1(); ProxyGetStocks.Timeout = 10000; try { lblMessage.Text = ProxyGetStocks.GetRating(TextBox1.Text); } catch (Exception err) { lblMessage.Text = err.Message; } Visual Basic.NET Code Example

Lesson: Creating an XML Web Service How to Create an XML Web Service XML Web Service Code Instructor-Led Practice: Creating an XML Web Service

How to Create an XML Web Service 1.Create a new XML Web Service project in Visual Studio.NET 2.Declare the WebMethod functions 3.Build the XML Web Service project 4.Test with a browser

XML Web Service Code.asmx page.asmx.vb page Imports System Imports System.Web.Services Class Service1 Public Function function1() As type 'function_here End Function End Class Imports System Imports System.Web.Services Class Service1 Public Function function1() As type 'function_here End Function End Class C# Code Example

Lesson: Configuring an ASP.NET Web Application Overview of Configuration Methods Configuring a Web Server Using Machine.config Configuring an Application Using Web.config Understanding Configuration Inheritance Storing and Retrieving Data in Web.config Using Dynamic Properties

Overview of Configuration Methods Machine.config file Machine-level settings Web.config files Application and directory-level settings Both Machine.config and Web.config files are: Well-formed XML camelCase Extendable

Configuring a Web Server Using Machine.config Settings in the Machine.config file affect all Web applications on the server Only one Machine.config file per Web server Most settings can be overridden at the application level using Web.config files

Configuring an Application Using Web.config One or more Web.config files per Web application All configuration information for the application is contained in the Web.config files Contains a section for each major category of ASP.NET functionality Security Mode General application settings Tracing

Understanding Configuration Inheritance Application-level Web.config file inherits settings from Machine.config file Settings in Web.config file that conflict override inherited settings Individual directories may have Web.config files that inherit from— and can override— application-level settings Machine.config Web.config CONFIG VirtualDir SubDir

Storing and Retrieving Data in Web.config Storing application settings in a Web.config file Retrieving application settings from a Web.config file <add key="pubs" value="server=localhost; integrated security=true; database=pubs"/> <add key="pubs" value="server=localhost; integrated security=true; database=pubs"/> Dim strPubs As String = _ ConfigurationSettings.AppSettings("pubs") Dim strPubs As String = _ ConfigurationSettings.AppSettings("pubs") AppSettingsReader App = new AppSettingsReader(); string strPubs = (string)App.GetValue("pubs", typeof(string)); AppSettingsReader App = new AppSettingsReader(); string strPubs = (string)App.GetValue("pubs", typeof(string));

Using Dynamic Properties Store property values in Web.config files rather than in the application's compiled code Allows easy updates without recompiling the application Enable and configure through object properties

Lesson: Deploying an ASP.NET Web Application Web Application Deployment Preparing a Web Application for Deployment Practice: Selecting Necessary Files Sharing Assemblies in the Global Assembly Cache Updating Your Web Application

Web Application Deployment Copy files locally or FTP files remotely Configure the target folder as a virtual directory in IIS Copy all necessary files, including the \bin directory and content No need to register components

Preparing a Web Application for Deployment 1.Build the Web application 2.Do not select unnecessary files Visual Studio.NET solution files (.vbproj,.vbproj.webinfo,.csproj,.csproj.webinfo, etc.) Resource (.resx) files Code-behind pages (.vb,.cs) 3.Copy or FTP necessary files to the production directory

Sharing Assemblies in the Global Assembly Cache The global assembly cache provides storage for assemblies you need to share Machine-wide cache for code Because DLL files are not registered, they are not easily shared between Web applications

Updating Your Web Application Copy or FTP files to update the Web application Do not need to stop and restart IIS.dll files can be updated while the site is still running

Questions?