1 / 46

Objectives In this lesson, you will learn to: Identify the components of dynamic Web applications

Objectives In this lesson, you will learn to: Identify the components of dynamic Web applications Identify the benefits of ASP.NET as a server-side scripting language Identify ASP.NET in .NET Framework Identify development environment of ASP.NET applications

brooke
Download Presentation

Objectives In this lesson, you will learn to: Identify the components of dynamic Web applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Objectives In this lesson, you will learn to: • Identify the components of dynamic Web applications • Identify the benefits of ASP.NET as a server-side scripting language • Identify ASP.NET in .NET Framework • Identify development environment of ASP.NET applications • Identify the features of ASP.NET • Identify the programming models in ASP.NET • Identify the server controls used in ASP.NET applications • Identify the files used in ASP.NET Web applications

  2. Objectives (Contd.) • Identify the code-behind feature of ASP.NET • Identify the events associated with a Web page • Identify ASP.NET built-in objects • Identify the structure of an ASP.NET page

  3. Introduction to Web Applications • Web applications • Are programs that can be executed either on a Web server (in case of server-side scripting) or in a Web browser (in case of client-side scripting). • Enable you to share and access information over the Internet and corporate intranets. • The content of a Web application that consists of only HTML pages is static. • To respond dynamically to user requests, you can use client-side and server-side scripting in addition to HTML pages.

  4. Components of Web Applications • A Web application can have client-side components, server-side components, or both. • Client-side scripting enables you to develop Web pages that can dynamically respond to user input without having to interact with a Web server. • A client-side script helps in reducing network traffic because it does not need to interact with a Web server to provide dynamic response to user input. • Client‑side scripting speeds up the response time of a Web application by ensuring that a Web server is not overloaded with the job of processing the client‑side script for every client.

  5. Components of Web Applications • Server-side scripting provides dynamic content to users based on the information stored in a remote location, such as a back-end database. • Server-side scripting includes code written in server‑side scripting languages, such as Active Server Pages (ASP) and Java Server Pages (JSP). • A server-side script is executed on a Web server.

  6. Introduction to ASP.NET • ASP.NET is a standard HTML file that contains embedded server-side scripts. • ASP.NET is the .NET version of ASP and is built on Microsoft .NET Framework. • ASP.NET applications are based on Common Language Runtime (CLR), .NET class libraries, and other tools integrated with Microsoft .NET Framework. • You can ensure the accessibility of .NET Framework by installing either of the following software components: • .NET Framework SDK (Software Development Kit) • Visual Studio .NET (VS .NET)

  7. Working of an ASP.NET Application • You create an ASP.NET application by using the tools integrated with the Microsoft .NET Framework. • After the application is developed, the ASP.NET files need to be stored on an IIS server, which is the Web server for Windows platform. • An IIS server processes ASP.NET files from top to bottom and then executes the scripts. • Finally, the results are sent to the Web browser that requested the ASP.NET file.

  8. Features of ASP.NET • ASP.NET has the following advanced features that help develop robust Web applications: • Compiled code • Enriched Tool Support • Power and Flexibility • Simplicity • Manageability • Scalability • Security

  9. Just a Minute… • What are the benefits of server-side scripting? • Why does the ASP.NET application execute faster than other server-side scripts?

  10. Programming Models in ASP.NET • ASP.NET provides two types of programming models: • Web Forms • Web Services • Web Forms enable you to create user interface for Web applications. • Web Services enable you to remotely access certain functionality at the server side. These services enable the exchange of data in a client-to-server or a server-to-server environment over the Web by using Simple Object Access Protocol (SOAP).

  11. ASP.NET Web Forms • Web Forms consist of a user interfaceandprogramming logic that is applied to the components of user interfaces. • ASP.NET Web Forms have the following advantages over other technologies: • Web Forms can be designed and programmed using Rapid Application Development (RAD) tools. • Web Forms support a rich set of controls, including user-defined and third party controls that make the application more user-friendly. • Web Forms can be programmed using any of the .NET Framework languages, such as C# or Visual Basic .NET.

  12. Server Controls in ASP.NET • ASP.NET server controls work within the ASP.NET Framework. • As soon as the client requests a Web page, ASP.NET converts these controls into HTML elements, which are displayed in the browser. These controls use the client-side script that ASP.NET automatically generates to alert the server whenever any event occurs. The code written for these controls are executed at the server end. • The base class of all server controls is the Control class that resides in the System.Web.UI namespace.

  13. Server Controls in ASP.NET (Contd.) • The four types of server controls in ASP.NET are: • HTML controls • Web controls • Validation controls • User controls • HTML Controls • Are the server-side replicas of the standard HTML tags and are executed by the aspnet_isapi.dll. • Are included in ASP.NET for backward compatibility and can be used when you need to migrate an existing ASP application to ASP.NET platform.

  14. Server Controls in ASP.NET (Contd.) • To use an HTML control, you need to import the System.Web.UI.HtmlControls namespace to a Web Form. • Web Controls • Include traditional form controls such as buttons and text boxes. • Also include controls that provide functionality, such as displaying data in a grid and selecting dates. • Exist in the System.Web.UI.WebControls namespace, and are derived from the WebControl base class.

  15. Server Controls in ASP.NET (Contd.) • Web controls are of the following types: • Basic Web controls– Correspond to the existing HTML tags such as TextBox, Label, Button, HyperLink, RadioButton, and CheckBox. • List controls – Used to build lists and include ListBox, DropDownList, CheckBoxList, and RadioButtonList. • Rich Web controls – Used to render an interactive calendar and to display banner advertisements and include the Calendar and Adrotator controls. • Data controls– Are used to display data from a database table. The controls included in this group are DataGrid, DataList, and Repeater.

  16. Server Controls in ASP.NET (Contd.) • Validation controls • Are used to validate the user input. • Some of the validation controls are CompareValidator, CustomValidator, RangeValidator, RequiredFieldValidator, and ValidationSummary. • User controls • Are ASP.NET pages that are converted into controls. • Are used if you want to create a server control that encapsulates the user interface (UI) of an existing Web page. • Enable you to easily reuse the same content and programming logic on multiple ASP.NET pages.

  17. Custom Controls • Web custom controls are compiled code, which makes them easier to use but more difficult to create. • Once you have created the control, you can add it to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. • You can also install a single copy of the Web custom control in the global assembly cache and share it between applications.

  18. Custom Controls (Contd.) • In ASP.NET, custom controls are similar to user controls. However, there are some significant differences between these two controls.

  19. Composite Controls • A composite control is a type of custom control that you can create in ASP.NET Web application. • Composite controls are compiled controls that combine the functionality of two or more existing controls.

  20. Just a Minute… • Which server controls are known as intrinsic controls? • Which is the base class of all server controls? • Which control is used to display banner advertisements in a Web page?

  21. Creating an ASP.NET Application • You can create an ASP.NET Web application in one of the following ways: • Using a text editor • Using the Visual Studio .NET IDE • When you create an ASP.NET application by using Visual Studio .NET IDE, the following files are created: • AssemblyInfo.cs • Global.asax • Web.Config • WebApplication.vsdisco • WebForm1.aspx

  22. Code-behind Feature of ASP.NET • The code-behind feature of ASP.NET enables you to divide an ASP.NET page into two files. One file contains the presentation content, and the other file, called the code-behind file, contains all the application logic. • The code-behind feature of ASP.NET offers the following advantages: • It makes code easy to understand and debug by separating programming logic from HTML and XML tags. • It allows the separation of effort between graphic designers who design pages and software engineers who write code. • It eliminates the issues of browser incompatibility by allowing code files to exist on the Web server and supporting Web pages to be compiled on demand.

  23. Just a Minute… • Which file contains configuration data on each unique URL resource used in the project? • Which is the default view of a Web Form page? • How would you convert an HTML control into a server control? • Which file contains only the programming logic applied on a Web Form page?

  24. Understanding the Automatically Generated Code • In the presentation (.aspx) file and the code-behind (.cs) file, ASP.NET automatically generates some lines of code. • The @Page directive is used to specify the page attributes based on which a page will be created. The different attributes of the @page directive are: • Language • AutoEventWireup • Codebehind • Inherits

  25. Page Events • The event-driven programming model of ASP.NET defines a sequence of events that are fired during the life cycle of a Web page. The sequence of these events is as follows: • Init • Load • Control • Unload

  26. Web Form Page Processing • A Web Form page in ASP.NET is processed using a sequence of events called round trip. • A Web Form page is a page file that is viewed by users through a Web browser. • When a user submits a page, the page is posted back to the Web server for server-side processing. • After the processing is done on the Web server, the page is sent back to the client. This sequence is called a round trip.

  27. ASP.NET Built-in Objects • ASP.NET has a number of built-in objects that run on a Web server and are programmed using methods, properties, and collections. • The built-in objects in ASP.NET are: • Application • Request • Response • Server • Session

  28. Structure of an ASP.NET Page • The structure of an ASP.NET page includes: • Directives • Code declaration blocks • Code render blocks • Server-side comments • Server-side Include directives

  29. Just a Minute… • Which object contains common information for all pages of a Web application? • Which object contains a status line that can indicate that a requested Web site exists? • Which object is created for each new user and destroyed when the user terminates the Web application? • Which object is used to provide access to the methods and properties of a Web server? • Which is the first page event to be fired when a user tries to access a Web page?

  30. Problem Statement 1.D.1 A Web Form is needed to sign up new users. This Web Form will be used to register new online users for the WebShoppe site. The sign up form should have first name, last name, user name, password, confirm password, address, city, state, postal code, country, telephone number, and e-mail id fields. The Form should display a welcome message when registration is successful. To register successfully, the user must provide a username and a password.

  31. Task List • Identify the data to be accepted from a user. • Identify the type of controls required. • Identify the mechanism to validate user input. • Design the Web Form. • Write the code to validate user input. • Execute the application.

  32. Task 1: Identify the data to be accepted from a user. Result: • As per the problem statement, the new user sign up Web Form should have the following fields to accept data from a user: • First name • Last name • User name • Password • Confirm Password • Address • City • State

  33. Task 1: Identify the data to be accepted from a user. (Contd.) • Postal code • Country • Telephone number • E-mail ID Task 2: Identify the type of controls required. Result: In the given scenario, we need to use the Label, TextBox, DropDownList, and Button controls.

  34. Task 3: Identify the mechanism to validate user input. Result: • In the problem statement, the user name, password, and confirmed password field entries need to be validated when a user clicks the Submit button on the form. To validate these three entries, you need to include three RequiredFieldValidator controls in the Web form. In addition, the values entered in the password and confirm password fields should match. Therefore, you need to include a CompareValidator control to the Web page.

  35. Task 4: Design the Web Form. Task 5: Write the code to validate user input. Task 6: Execute the application.

  36. Just a Minute... • Fill in the blanks: • The _____________ property of the CompareValidator control specifies the ID of the server control to use for comparing values. • The _____________ property of the RequiredFieldValidator control specifies the ID of the server control whose value is to be checked.

  37. Summary In this lesson, you learned that: • A Web application can have client-side components, server-side components, or both. • ASP.NET, the .NET version of ASP, is built on Microsoft .NET Framework. You can ensure the accessibility of the .NET Framework by installing either of the following software components: • .NET Framework SDK (Software Development Kit) • Visual Studio .NET (VS .NET) • ASP.NET provides two types of programming models: • Web Forms • Web Services

  38. Summary (Contd.) • Web Forms enable you to create form-based dynamic Web pages. • Web Services enable you to remotely access certain functionality at the server side. • When you create a Web application, HTML or XML elements and server controls are saved in a file called Page file. • The base class of all server controls is Control class that resides in the System.Web.UI namespace.

  39. Summary (Contd.) • Server controls are broadly of the following types: • ASP.NET HTML controls • ASP.NET Web controls • ASP.NET Validation controls • ASP.NET User controls • ASP.NET Web controls are of the following types: • Basic Web controls • List controls • Rich Web controls • Data controls

  40. Summary (Contd.) • Custom controls are compiled software components that you can create to share the same customized control among a number of ASP.NET applications. • Composite controls are compiled controls that combine the functionality of two or more existing controls. • You can create an ASP.NET application by using: • A text editor, such as Notepad • Visual Studio .NET IDE

  41. Summary (Contd.) • When you create an ASP.NET page by using a text editor, you can browse the page only after you have created a virtual directory using IIS. • The automatically generated ASP.NET files in Visual Studio .NET are: • AssemblyInfo.cs • Global.asax • Web.config • WebApplication.vsdisco • WebForm1.aspx

  42. Summary (Contd.) • Web Forms have two views: • Design view • HTML view • The code-behind feature of ASP.NET enables you to divide an ASP.NET page into two files: • The presentation file that stores user interface contents • The code-behind file that stores application logic

  43. Summary (Contd.) • The @Page directive is used to specify page attributes based on which the page is created. The different attributes specify the following: • Language • AutoEventWireup • Codebehind • Inherits

  44. Summary (Contd.) • The sequence of events that is fired when a user requests a Web page is: • Init • Load • Control • Unload

  45. Summary (Contd.) • The built-in objects in ASP.NET are: • Application • Request • Response • Server • Session

  46. Summary (Contd.) • The structure of an ASP.NET page includes: • Directives • Code declaration blocks • Code render blocks • Server-side comments • Server-side Include directives

More Related