In todays internet world,Companies see the web as a business opportunity – as a new advertising, communication, promotional or selling channel. Individuals see the Internet as a mobile workplace. You can use office and multimedia applications directly on the Internet from any place in the world. Millions of users also use these at the same time you do.And you need only an Internet connection and some suitable appliance (e.g. smart phone, PDA , laptop or desktop in Internet café). The applications available on the Internet are called web applications or online applications. This picture summarises the most useful web application types that you can find on the World Wide Web, which in fact is a system of interlinked hypertext documents accessed via the Internet. With a web browser, one can view web pages that may contain text, images, videos, and other multimedia and navigate between them via hyperlinks
TCP/IP is the communication protocol for the internet.TCP/IP defines the rule computers must follow to communicate with each other over the internet.
Typically, there is only one web server required for a web site. But large web sites like Yahoo, Google, MSN etc. will have millions of visitors every minute. One computer cannot process such huge numbers of requests. So, they will have hundreds of servers deployed in different parts of the world so that can provide a faster response.A web server can hosted hundreds of web sites. Most of the small web sites in the internet are hosted on shared web servers. There are several web hosting companies who offer shared web hosting. If you buy a shared web hosting from a web hosting company, they will host your web site in their web server along with several other web sites for a Fee.Examples of web server applications1. IIS2. Apache
Ok what do you need to create a web application?1. A web server.2. An editor to develop the web pages.3. A browser to view the web page you develop.4. A database program like MS Access, SQL Server etc, if your web site need to save data into a database.In the real world , a web server will be hosted on a secure server, located in a safe place and will be always connected to high speed internet. However, to develop a web application, you don't need to worry about security and internet connectivity. You can use your own development computer as the 'Web Server'.So, your development computer must have all the 4 systems mentioned above. Web ServerThere are several types of web servers. But if you like to develop ASP.NET web applications, you need a specific web server called 'Internet Information Server' (IIS). IIS comes as part of Windows. But it is not installed by default, when you install Windows. Please see the chapter 'Installing IIS' to find more about installing IIS.Ideally, you do not need any special editor to develop a web application. If you are an expert, you can simply use notepad to type HTML and the code for the web pages. Its like why do you want to hand-wash the vessels when there is a dish washer ?!You don't need to make your hands dirty! Microsoft gives a tool called 'Visual Studio .NET' to edit web pages and write code for ASP.NET.Visual Studio .NET (VS.NET)Visual Studio .NET allows to easily create web pages. Some of the benefits in using Visual Studio .NEt are:You can simply drag and drop html controls to the web page and VS.NET will automatically write the HTML tags for you.Start typing an HTML tag and VS.NET will complete it! When you start typing a tag, VS.NET will show you the HTML tags starting with the characters you typed. So, you don't need to even remember all the tags.If you type any HTML tags wrong, VS.NET will highlight the errors and tell you how to correct it.So, even if you are not an expert, VS.NET can help you develop great web pages.BrowserYou need a browser to view the web pages you create. If you have any windows operating system in your computer, you will already have a free browser (called 'Internet Explorer')Database programA database program like MS Access or SQL Server is required only if you need to save data into database. It is not mandatory that all web sites need a database program. Internet Information Services (IIS)If you have Windows 2000 or Windows XP Professional, you may have IIS already installed in your computer. IIS is part of the Windows operating system, but it is not selected by default. So, if you choose default options when you installed the operating system, you may not have the IIS installed.To find if you already have IIS installed, go to the "Control Panel" and select "Administrative Tools". Check if there is a shortcut for "Internet Information Services" exists as part of the "Administrative Tools". If it does not exist, you will need to install IIS.
Only on server operating systems like 'Windows 2000 Server' or 'Windows 2003 Server', you can create multiple Web Sites. In other systems like Windows XP, Windows 2000 Professional etc, you can have only 1 web site (which is the 'Default Web Site' created by the system). But you can have any number of web applications under this default web site. Each web application will need to be created as a 'virtual directory' under any one of the 'web sites'. If you do not have a server operating system, you have to always create your web applications under the 'Default Web Site'.If you are going to deploy your web application to windows server 2003, then you will be integrating IIS 6 with ASP.NET. On windows server 2008 or vista or windows 7 you will work with IIS7.Each web application you create in your machine needs a virtual directory. In the above image, we have two web applications (named 'WebApplication1' and 'WebApplication2')
Life Cycle of a Web RequestViewing a web page is a simple process for a visitor. Just type the URL in a web browser like Internet Explorer or click on a hyper link in any existing web page. The web browser will display the page instantly to you.But do you know that there are several computers involved in this process? Even though it is a very complex process, we can summarize the process as shown below:1. You type the web page address (URL) in a browser. For example, consider the current page http://www.aspspider.com/tutorials.aspx. This URL has 3 parts:The protocol - http:The server name - www.aspspider.comThe file name - tutorials.aspx6. Web server sends the requested page to the browser.7. When a response is received by the browser, it displays the web page to the user who typed the URL.After you typed the URL in the browser, the request sent by the browser may go through several computers in the internet before it reaches the actual web server. You must be surprised to know that so many things happen and several computers are involved before a simple web page is displayed to you. Most of the steps in the above process happens behind the screen. A visitor need not worry about how a web page is processed and served to the browser.So, by now you must have got a better picture about how a windows application is different from a web application. When you run a windows application (desktop application), only one computer is involved in the whole process. You start an application in your computer and it runs in your computer. But when you request a web page from your home computer, the request goes through several servers in the internet and finally it reaches a computer called 'Web Server'. The actual web page is processed in the web server.
HTTP modules are classes that have access to the incoming request. These modules can inspect the incoming request and make decisions that affect the internal flow of the request. After passing through the specified HTTP modules, the request reaches an HTTP handler, whose job it is to generate the output that will be sent back to the requesting browser. HTTP handlers are the endpoints in the ASP.NET HTTP pipeline. The job of the HTTP handler is to generate the output for the requested resource. For ASP.NET Web pages, this means rendering the Web controls into HTML and returning this HTML. And for a Web service, it would involve executing the specified method and wrapping its return values into an appropriately formatted SOAP response.
The following is a list of the important elements of an ASP.NET page:DirectivesCode declaration blocksASP.NET controlsCode render blocksServer-side commentsServer-side include directivesLiteral text and HTML tagsPage directives are used to specify settings that affect the entire ASP.NET page. ASP.NET pages can be written in many different languages, so we must specify which is used for this page. The debug attribute tells the IIS webserver (or any other webserver capable of understanding it) to print debug information after the bottom of our page. The trace attribute tells IIS to print more detailed information about the execution of the page, including tracing variables. Page directives are included using special delimiters:<%@ %> The next thing you'll notice that sets this page apart from a regular HTML-based page is the script block immediately following the page directive:<script runat="server"> ' ASP.NET page code goes here Sub Page_Load() End Sub </script>App_Data is essentially a storage point for file-based data stores (as opposed to a SQL server database store for example). Some simple sites make use of it for content stored as XML for example, typically where hosting charges for a DB are expensive.
It is a well known fact that ASP .Net pages functional logic can be written in two ways. The ASP .Net code can either be written inside the ASPX page or it can be included as a asp_net_code.cs or vb.net file.When the ASPX page is embedded with the code of either C# or VB .Net, the ASP .Net run time automatically compiles the code into an assembly and loads it. If the code is kept in a separate source file either as a VB or C# file, it has to be compiled by the programmer, which will be used by the run time for further execution.When a the aspnet_wp.exe gets a request for an aspx page which is written without a code behind class file, it generates a class file dynamically for the corresponding page and places it inside the Temporary ASP .Net Files somewhere under the tree structure of the .Net installation path. Then it compiles this into a DLL and finally deletes the class file after successful compilation. It will render the pages from the same binary DLL for any subsequent requests. If it sees any change in the time stamp of the .aspx file, it recognizes that there is some change and recompiles it again for further use.So ultimately the compilation is only once and all the subsequent requests are entertained only by using the compiled code/DLL.
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering. It is important to understand the page life cycle so that you can write code at the appropriate life-cycle stage. Page request:The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled or whether a cached version of the page can be sent in response without running the page.Start:In the start step, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. Additionally, during the start step, the page's UICulture property is set.Page initialization:During page initialization, controls on the page are available and each control's UniqueID property is set. Any themes are also applied to the page. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.Load:During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.Validation:During validation, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page.Postback event handling:If the request is a postback, any event handlers are called.Rendering:Before rendering, view state is saved for the page and all controls. During the rendering phase, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property.Unload:Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed.
Having an understanding of the architecture of your asp.net development environment would certainly help you make you a better developer.ASP.NET is nothing like the legacy ASP with which many developers are familiar. You develop ASP pages by using VBScript or JScript, and they are interpreted, meaning that they are executed just as they are written, directly from the page. But ASP.NET is entirely different in that ASP.NET pages are compiled before they are executed.When you write ASP.NET code, you do it in like human-readable text. Before ASP.NET can run your code, it has to convert it into something that the computer can understand and execute. The process of converting code from what a programmer types into what a computer can actually execute is called compilation.Exactly how compilation takes place in ASP.NET depends on the compilation model that you use. Several different compilation models are available to you in ASP.NET 3.5.The Web Application Compilation ModelHere you use the Build menu in Visual Web Developer to compile your application into a single DLL file that is copied to a bin folder in the root of your application. When the first request comes into your application, the DLL from the bin folder is copied to the Temporary ASP.NET Files folder, where it is then recompiled into code that the operating system can execute in a process known as just-in-time (JIT) compilation. The JIT compilation causes a delay of several seconds on the first request of the application.The Website Compilation Modelall files in the application are copied to the remote web server and are then compiled on the fly by ASP.NET at browse time.When this compilation model is used, ASP.NET compiles the application into one or more DLLs in the Temporary ASP.NET Files folder when the first page is requested. The DLLs are in a subfolder with a name derived from a special naming convention that allows for dynamic and random directory names. Therefore, a website called MyWebSite might execute from a folder on the server.The compilation of the App_Web DLLs takes place without any explicit action on your part. It's all automatic.The website compilation model is convenient because developers can open a code file or an ASPX page and make modifications to it on the live server. When those changes are saved, they go into effect immediately. However, using this method requires you to copy all the source code for your application to the live server, and this may be a concern to some developers.The Precompilation ModelThe precompilation model allows you to compile your ASP.NET application into one or more DLLs that can then be copied to the web server in place of any code.If you are using Visual Web Developer Express Edition, you won't have the option to precompile your website within the user interface, but it can still be accomplished if you use the aspnet_compiler.exe utility that ships with the .NET Framework.NOTEThe aspnet_compiler.exe utility is located in the Windows\\Microsoft.NET\\Framework\\v2.0.50727 directory.The aspnet_compiler.exe utility runs from a command line. If you have the .NET Framework SDK v2.0 installed, you can select Start, All Programs, Microsoft.NET Framework SDK v2.0 and then click SDK Command Prompt to open a command prompt. This command prompt automatically sets the necessary environment variables to enable you to run aspnet_compiler.exe without changing into the v2.0.50727 directory.
Introduction to ASP.NET
Learning ASP.NET - IntroductionGoal:This module introduces the audience to Microsoft’s Web development platformbased on the .Net framework : ASP.NET. Important components of the ASP.NETarchitecture and web development concepts are discussed.
What is on the web ? Smart Phone ClientSearch Engines and Payment Gateways iPad PDA CRM and Help Desks Laptop Online Shopping Web Server Social Networking Sites Desktop Company Portals Business Reporting and Dashboards
ASP.NET• Microsoft ASP.NET is a framework for building web applications, that is, applications that run over the web.• Uses the client-server paradigm that is represented mostly by a browser forwarding requests for resources of different kinds to a web server.• A Web server is a software program which serves web pages to web users (browsers).• A web server delivers requested web pages to users who enter the URL in a web browser. Every computer on the Internet that contains a web site must have a web server program. URL http://www.sharepointindia.com TCP/IP HTTP Protocol Request for a web page Response From the Internet Explorer server Firefox Safari Google Chrome
Web Server – Behind the Scene• The web address or URL used to access a web page can be broken into two parts The protocol we are http://www.sharepointindia.com going to use to connect to the server (http) The server name (www.sharepointindia.com)• The browser tries to communicate with the server looking up for the server name. Server is identified through an IP address but the alias for the IP address is maintained in the DNS Server or the Naming server.• The browser looks up these naming servers, identifies the IP address of the server requested and gets the site and gets the HTML tags for the web page. Finally it displays the HTML Content in the browser.• When you try to access a web site, you dont really need to know where the web server is located. The web server may be located in another city or country, but all you need to do is, type the URL of the web site you want to access in a web browser.
Components for creating a Web Application Browser Code EditorWeb Server (IIS/Apache) Web Pages Database Internet Information Server
Working with IIS and virtual directories• In IIS7,Virtual directories and applications are now separate objects, and they exist in a hierarchical relationship.• A site contains one or more applications, an application contains one or more virtual directories, and a virtual directory maps to a physical directory on a computer.• When you create a new ASP.NET project using Visual Studio .NET, it will automatically create a virtual directory for it in the path c:inetpubwwwroot directory and all files related to the project will be placed inside this folder. This folder will be set as a "Virtual Folder" so that you can access the web site using the URL "http://localhost/ShopCart".
How do Web Applications work ?• You type the web page address (URL) in a browser.• Browser communicates with a computer in internet called Domain Name Server to find out the IP Address of the server and establishes a connection to the web server at that IP Address• Server composes a Request for the specified URL and sends the request to the web server to which it has established a connection.• The web server identifies the type of the page requested. If it is an asp.net web page, then browser request is handed over to the asp.net service.• The asp.net service processes the asp.net page and generates the html output• Web server sends the requested page to the browser. When a response is received by the browser, it displays the web page to the user who typed the URL.
ASP.NET Request Processing• When a request comes to the Web server, it is routed to the proper place ( asp.dll for classic ASP page requests, and the ASP.NET engine for ASP.NET requests) based on the requested files extension.• The ASP.NET engine is often referred to as the ASP.NET HTTP pipeline, because the incoming request passes through a variable number of HTTP modules on its way to an HTTP handler.
Structure of a WebsitePage Directive Content Tags ASP.NET Web Application ASP.NET Website
Anatomy of a Web Page Default.aspx.csDefault.aspx(Split View) Default.aspx.designer.cs
DemoCreating and testing your first ASP.NET Web Page