
Chapter 1 Introducing ASP.NET Web applications have revolutionized the way business is conducted. These applications enable organizations to share and access information from anywhere and at anytime. This has majorly moved the focus of application development from desktop applications to Web applications. One of the most popular server-side technologies used today for developing Web applications is ASP.NET. This chapter introduces the basics of Web development. It also discusses the architecture, functioning, and features of ASP.NET. In addition, it explains how to develop ASP.NET applications. Objectives In this chapter, you will learn to: Identify the basics of Web development Explore ASP.NET Develop ASP.NET applications Introducing Web Development Among all technologies, the Internet has been the fastest growing technology. Ever since its inception, the Internet has evolved exponentially. In the recent years, it has changed the way business is conducted. Prior to the evolution of the Internet, organizations were unable to create awareness about themselves because the communication media were limited. Moreover, the organizations could deliver only limited information by using the existing communication media such as television and radio. However, with the inception of the Internet, organizations found a new medium through which they could reach a larger range of people irrespective of their geographical locations. Therefore, organizations increasingly became dependent on the Internet for sharing and accessing information. This resulted in changing the focus of application development from desktop applications to Web applications. Web applications are programs that are executed on a Web server and accessed from a Web browser. These applications enable organizations to share and access information on the Internet and corporate intranets. This information can be accessed from anywhere and at any time. In addition, Web applications can support online commercial transactions popularly known as e-commerce. An online store accessed through a Web browser is an example of a Web application. A Web application consists of Web pages. Web pages can be of the following types: Static Web Page: A Web page that consists of only Hyper Text Markup Language (HTML) is a static Web page. A static Web page does not respond dynamically to the actions performed by a user. Dynamic Web Page: A Web page that responds dynamically to the actions performed by a user is a dynamic Web page and an application that consists of dynamic Web pages is a dynamic Web application. Such an application can be created by using server-side scripts, client-side scripts, or both in addition to HTML pages. Server-Side Scripting With the increase in the usage of the Internet as the information medium, organizations are creating dynamic Web applications. Dynamic Web applications enable a user to: Retrieve data from a database that may not reside on the computer where the Web server is located. Submit data from HTML forms. Get information based on the input. To incorporate these features in a Web application, you need to implement server-side scripting. Server-side scripting provides users with dynamic content that is based on the information stored at 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 the Web server. When a browser requests for information on a website that is created by using server-side technology, the Web server to which the request is sent, first processes the script and then sends the results back to the browser. For example, if a Web page includes a server-side script to display the current time of the system on which the website is hosted, the script will be processed at the server and the current system time will be sent back to the browser. The following figure shows the working of server-side scripts. Working of Server-Side Scripts Client-Side Scripting Client-side scripting enables you to develop Web pages that can dynamically respond to user input without having to interact with a Web server. Suppose, you have a Web application that requires users to enter the user name and password before displaying the home page. You need to ensure that a user does not leave the user name and password fields blank. To check whether a user has left the user name and password fields blank, you can write client-side scripts. In addition to providing dynamic content, a client-side script helps reduce network traffic because it does not need to interact with a Web server to provide dynamic response to the user input. Client-side scripting also speeds up the response time of a Web application. This happens because a Web server is not overloaded with the job of processing the client-side script for every client. Scripting languages, such as VBScript and JavaScript, are used to write client-side scripts. The following figure shows the working of client-side scripts. Working of Client-Side Scripts Limitations of Client-Side Scripting In spite of the all the advantages, client-side scripting has some major limitations. These limitations are: Browser support: Client-side scripting is not supported equally by all browsers and operating systems. Isolation: Client-side scripts cannot access server-side resources. It is difficult and requires a lot of coding to access a file or interact with a database on the server by using client-side scripts. Security: Client-side scripts are visible to the end users. Therefore, they can be tampered by malicious users. Thin clients: Web-enabled devices such as mobile phones, palmtop computers, and Personal Digital Assistants (PDAs) can communicate with Web servers. These devices act as thin clients that can use Web applications containing server-side scripting. However, these devices do not support client-side scripting such as JavaScript or VBScript. Note In spite of all the limitations, client-side scripting is still in use. ASP.NET allows you to use client-side scripting in addition to the server-side scripting to create rich and responsive Web applications. Exploring ASP.NET ASP.NET is a server-side technology that enables programmers to create dynamic Web applications. It has a number of advanced features such as simplicity, security, and scalability that help you develop robust Web applications. These advanced features of ASP.NET are based on the .NET Framework. ASP.NET in the .NET Framework ASP.NET is built on the Microsoft .NET Framework. Microsoft introduced the .NET Framework to help developers create globally distributed software with Internet functionality and interoperability. The following figure displays the elements of an ASP.NET application and how the elements fit in the broader context of the .NET Framework. Elements of an ASP.NET Application in the .NET Framework The preceding figure indicates that an ASP.NET application has the following elements: Web Form Pages: Enable you to include user interfaces, such as Text box control, List box control, and the application logic of Web applications. Configuration Files: Enable you to store the configuration settings of an ASP.NET application. XML Web Service Files: Define a Web service that can be called by an ASPX file over the Internet or from a local network. Web forms and the state management feature of ASP.NET constitute the ASP.NET Page Framework. There are also a number of runtime services available in ASP.NET. The ASP.NET runtime services include view state, session state, and application state management, Web security, and the caching mechanism of ASP.NET applications. The runtime services of ASP.NET interact with .NET Framework base classes, which in turn, interact with the Common Language Runtime (CLR) to provide a robust Web-based development environment. Working of an ASP.NET Application After creating an ASP.NET application, the ASP.NET files need to be stored on a Web server such as Internet Information Services (IIS) server, which is the Web server for the Windows platform. The Web server processes the ASP.NET files and then executes the scripts. Finally, the results are sent to the Web browser that requested the ASP.NET file. The following figure depicts how a Web server processes a request for an ASP.NET file. Processing of a Request for an ASP.NET File The steps involved in the execution of an ASP.NET file are: 1. A Web browser sends a request for an ASP.NET file to a Web server by using a Uniform Resource Locator (URL). 2. The Web server, such as IIS, receives the request and retrieves the appropriate ASP.NET file from the disk or memory. 3. The Web server forwards the ASP.NET file to the ASP.NET script engine for processing. 4. The ASP.NET script engine reads the file and executes any server-side script it encounters. 5. The processed ASP.NET file is generated as an HTML page. 6. The Web server then sends the HTML page to the client. 7. The Web browser interprets the output and displays it. A Web server generates and sends only the HTML output to the client. As a result, it helps to hide the code of the ASP.NET file from the users who access an ASP.NET Web page. Note ASP.NET script engine is the engine that processes the server-side scripts contained in an ASP.NET application. After processing the scripts, the engine renders the result as an HTML document and sends it back to the browser. Features of ASP.NET In addition to hiding the code of the ASP.NET file from the users, ASP.NET has the following advanced features that help develop robust Web applications: Compiled code: The code written in ASP.NET is compiled and not interpreted.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages274 Page
-
File Size-