|
|
|
WEB APPLICATIONS A Web Application consists of a set of Web pages that are created based on user requests. Search engines, online stores, etc. are all Web applications. Web applications are client/server applications as the processing power is split between the client machine and the server. The computers communicate via HTTP. The Web application is stored on the server and displayed on the client. Internet Information Services (IIS) is generally used to send the ASP.NET pages from the server to the client. The server must also have the Microsoft.NET Framework installed. However, the framework is a free download from Microsoft's Web site and is included with Visual Studio.NET 2005. The user interface for a Web application is the series of Web pages rendered to the client by ASP.NET/IIS. A client needs nothing more than a browser to view ASP.NET pages. Internet Explorer is not required; FireFox, Mozilla or any other browser can be used. This is because IIS returns pure HTML to the client. ASP.NET can be used both on the Internet as well as on an Intranet. When used with an Intranet, the IIS server running ASP.NET must be on the same network as all of the clients. ASP.NET VS. STATIC PAGES ASP.NET is part of the .NET framework. You utilize ASP.NET by creating Web forms through notepad or Visual Studio.NET 2005 as well as by accessing the .NET class library in order to add functionality to your GUI. The ASP.NET service runs inside of the CLR, ASP.NET compiles and executes your code and returns plain HTML to the browswer. ASP.NET is a fantastic improvement over classic ASP because the GUI is separate from the code. No longer will Web designers and coders have to dig deep into the same page and hope that they don't mess up what the other is working on. In addition ASP.NET allows session state to be preserved even if the user has cookies disabled or if the Web application is hosted by several different servers. In classic ASP either scenario would prevent session variables from maintaining state. An example of a session variable is one that contains a user Id and password. The user cannot access any page in the site if he/she is not logged in. Before the page is rendered, the user ID and password are accessed through the session variable and checked to ensure that the values are legitimate. ASP.NET pages are much different than traditional static HTML pages. For starters, HTML pages have a .htm or a .html extension. Furthermore, special software isn't needed to convert the document into a format where it is visible from a Web browser. For example, you can double click on any html file stored on your local machine and view the page in a Web browser. The same cannot be said for an ASP.NET page. This is because the .aspx page (ASP.NET file extension) must be processed by ASP.NET in order to turn the code into HTML. Another difference between the two types of pages is that everyone who views a static HTML page sees the same content. ASP.NET pages can be personalized based on user input or other variables. That's why ASP.NET pages are referred to as dynamic Web pages. When a user requests a static HTML page by clicking on a link or entering the address, IIS running on the server finds the page and sends it back to the client. However, if the user requests a dynamic page, IIS sends the file to the ASP.NET engine. The ASP.NET engine processes the page and returns the results as pure HTML to IIS. IIS then returns the HTML page to the client. That's why when you view the source code of an ASP.NET page from within a Web browser, you can't tell which information is dynamic and which is static. The browser doesn't care if a page is dynamic or static as long as it consists of HTML. IIS knows to send an .aspx page (the asp.net extension) to the ASP.NET engine because IIS maintains a list of application mappings. The mappings indicate which program a file extension is associated with. Web applications end after each page request. This is because HTTP is a stateless protocol. Web servers don't remember users from one request to another. See figure 1-5 on page 13. Later on in the course we will learn how to maintain state using a variety of bells and whistles provided by ASP.NET. These include session state, profiles, application state, and view state. Not all Web Servers run on Windows. Those that don't tend to run Apache software. VISUAL STUDIO.NET 2005 We will be using Visual Studio.NET 2005 to create our Web applications. VS.NET is a rich graphical environment that offers automatic error detection before compilation (squiggly lines underneath your code indicate something is awry), debugging tools to find your errors, drag and drop page design, and intellisense (drop down lists appear to help you write your code) VS.NET 2005 comes in several different editions. The free version, the express edition, can be downloaded at no cost until November 2006. After that time it will cost $100. Previous downloads will not stop working. The standard edition and professional editions are similar except that the professional edition integrates better with database applications running SQL Server 2005. The Team System version is the top of the line version that includes features added to support large development teams. .NET FRAMEWORK COMPONENTS The .NET Framework has two main components, the class library and the common language runtime. The library consists of classes that provide the objects you need for developing Web applications. Classes also exist for security, file input/output, and Windows applications. The classes are organized in a hierarchical structure by namespaces. Namespaces are logical in that classes belonging to the same namespace can be split up into multiple files. The Common language runtime (CLR) provides the services needed for executing ASP.NET applicaitons. It doesn't matter if a Web application was created in VB.NET or C# since the CLR compiles all code to the same intermediate language (IL). All forms in the same web application, however, must be created in the same language. THREE ENVIRONMENTS FOR DEVELOPING ASP.NET APPLICATIONS In the standalone environment, the same computer acts as both client and server. This is perfect for when you are developing. Your machine, however, needs to be running ASP.NET 2.0. However, IIS is not necessary since VS.NET 2005 ships with its own development server! It also ships with SQL Server 2005 express edition. Local area networks and wide area networks have similar requirements. The server must be running the .NET framework and IIS. However, FrontPage extensions must be installed on a LAN and an FTP server must be running on a WAN. COMPILING A WEB APPLICATION
Steps 1-4 only occur when the page is being accessed for the first time. This is because ASP.NET caches the assemblies. However, if any of the source files have been changed, the page is recompiled. In ASP.NET 2.0, the control declarations are no longer included in a hidden code region of the code behind file. They are now generated at run time and stored in a partial class so that the code behind file can no longer get out of sync with the page file. This happened often in ASP.NET 1.X. SOFTWARE REQUIREMENTS:
CHAPTER ONE QUESTIONS
|