Friday, 23 May 2014

ASP.NET - How web applications work ?

Web applications work quite different from regular windows applications. This chapter explains the fundamentals of a web application and how a web page is served when a client makes a request for a web page.

Web applications work quite different from regular windows applications. There are several computers involved when you view a web page.

Life Cycle of a Web Request

Viewing 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:
 

01. You type the web page address (URL) in a browser. For example, consider the current page http://www.example.com/tutorials.aspx. This URL has 3 parts:

  • The protocol - http:
  • The file name - tutorials.aspx
  • The server name - www.example.com
02. Browser communicates with a computer in internet called 'Domain Name Server' to find out the IP Address of the server (Eg: www.example.com).

03. Browser established a connection to the web server at that IP Address.

04. Server composes a 'Request' for the specified URL and sends the request to the web server to which it has established a connection.

05. The web server identifies the type of the page requested. If it is an asp.net web page, then browser knows that needs some processing by the asp.net service running as part of the web server. The request is handed over to the asp.net service. The asp.net service processes the asp.net page and generates the html output. 

06. Web server sends the requested page to the browser.

07. 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.

ASP.NET - What is a Virtual Directory and how to create it?

This article explains the concept of virtual directory and how to create it manually.

What is a virtual directory ?

A virtual directory represents a web application and it points to a physical folder in your computer.

A web application is accessed using a virtual directory name instead of a physical folder name. For example, if you have a web application called "Shopcart" in your machine, you will have a virtual directory for this web application. You will access your web application using the URL httP://localhost/Shopcart. If your virtual directory name is "Test", then your web application URL will be "http://localhost/Test".

Assume you have a web application called "Shopcart", created under the physical folder "C:\MyProjects\Shopcart".

You can go to IIS and see this virtual directory listed. Right click on this virtual directory name in IIS and see the properties. You can see that this virtual directory is pointing to the physical location "C:\MyProjects\Shopcart".

If you have a file called "File1.aspx" under the folder "C:\MyProjects\Shopcart\", then you can access this file using Internet Explorer with the URL "http://localhost/Shopcart/File1.aspx"

How to create a virtual directory ?

When you create a new web project using, a new virtual directory will be created automatically for you. This virtual directory will point to a new folder created under C:\Inetpub\wwwroot.

If you like to better organize your projects and files in your favorite folder, you must manually create a new folder for each project in your preferred location and convert it into a virtual folder manually.

There are couple of ways you can do this.

Method 1: Open the IIS. Right click on the node "Default Web Site" and select "new Virtual Directory". When it prompt you to enter the "alias", enter the virtual directory name you want(Eg: Shopcart). In the prompt for "directory", select the folder which you want to make a virtual directory (Eg: C:\MyProjects\Shopcart). Select other default values and press "Finish". Now you should be able to see your new virtual directory in IIS.

Method 2: In the explorer, go to the folder(Eg: C:\MyProjects\Shopcart) which you want to make a "virtual directory". Right click on the folder name and select "Properties". Select the tab "Web sharing" and select the option "Share this folder". It will prompt you with a default Alias name same as the folder name (Eg: Shopcart). Simply select the default values and press "OK".

ASP.NET - Working with IIS and virtual directories

This article explains how to use IIS (Internet Information Services) and how to work with virtual directories.

Internet Information Services (IIS) helps you manage the web applications and web sites in your computer.

How to open IIS

There are several ways you can open the Internet Information Services tool.

Method 1: Open the 'Control Panel', select 'Administrative Tools' and then double click the shortcut 'Internet Information Services'

Method 2: Go to the "start" menu, select "Run" and then type "inetmgr". Press "OK" to open the IIS tool.

The IIS admin tool look like this:



In the above image, the name "MANJU" represents the computer name. Under the node "Web Sites", it displays all the web sites. When you install IIS, it creates a default web site for you. Under the "Default Web Site" node, you can see all virtual directories listed.

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'.

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')

When you create a new ASP.NET project using Visual Studio .NET, it will automatically create a virtual directory for you.

For example, if you create a new ASP.NET project using Visual Studio .NET called "ShoppingCart", it will create a new virtual directory with the name "ShoppingCart". After you create the ASP.NET project, you can see the virtual directory listed in the IIS.

You can right click on the virtual directory name in IIS and select 'Properties' to view various properties of the virtual directory. One important property is "Local Path". The "Local Path" property represents the actual location of the web application.



By default, when you create a new ASP.NET project, visual studio creates the project under the folder "C:\Inetpub\WWWRoot". For example, if you create a new ASP.NET project called "ShopCart", VS.NET creates a folder called "C:\Inetpub\WWWRoot\ShopCart" and all files related to the proejct 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".

If you are working on several projects, you may want to organize your projects in some specific folder instead of "C:\Inetpub\WWWRoot". What you need to do is, create a virtual folder manually before you create the project.

For example, if you need to create an ASP.NET applciation called "Shopcart" under the folder "C:\MyProjects", first create the folder "C:\MyProjects\Shopcart". Now convert this folder as a virtual folder. Now you are ready to create the project using VS.NET. If the virtual folder already exists, VS.NET will NOT create a new virtual folder under the WWWRoot folder. It will use the existing virtual folder.

What is "localhost" ?

"localhost" represents "current machine". If you are accessing any web applications in your own machine, you can use the URLhttp://localhost/XXXXXXX. If your web site is in another machine, you can use the IP Address of the computer instead of "localhost". For example, if the "Shopcart" web application is in a computer with the IP Address "128.32.65.21", then you can access the site from your computer using the URL"http://128.32.65.21/Shopcart".

Stop and start IIS

You may never need to stop and start your IIS. When your computer is started, IIS is automtically started.

Actually, IIS is a 'windows service'. What you see as 'Internet Information Services' is an admin tool provided by Microsoft to manage the real IIS which works in the background. IIS runs as a windows service in the background and what you see is only a tool to manage the IIS service.

If you like to stop or start IIS, select the "Default Web Site" in IIS tool and select "stop" or "start" from the right click menu. If you stop IIS, you cannot access your web sites anymore. Even, if you try to open the ASP.NET project in Visual Studio, it will complain that web site is currently not available.

ASP.NET - Web Hosting

Once you have created your own web site, you need to host it in a web server. This chapter explains how to find a web hosting service suitable for you.

Once you have created your own web site, you need to host it in a web server. A web server machine is pretty much same as your local computer where you developed your web application.

However, in order to make your web site publicly available across internet 24 hours a day, your server must meet certain criteria.

  1. The machine must be a high speed machine so that it can handle several requests from various users at the same time. 
  2. When you host a public web site, your machine is open to the outside world. Someone can write a malicious program to hack your machine and destroy your valuable data. An internet web server must be protected with Antivirus and firewall.
  3. Must be connected to nu-interrupted power supply (UPS) so that a power failure will not shutdown your web site.
  4. Must be connected to very high speed internet all the time. A DSL or high speed cable internet may be sufficient for small web sites, but large and secured web sites will need a higher speed connections like T1.
  5. A good backup mechanism to recover data if the server crash unexpectedly.
Large web sites which have several thousand hits every hour must be supported with multiple processors, lot of memory and disk space to ensure high availability of the web sites all the time. Also, consider web farming with multiple web servers so that if one server is down for sometime, the other server can handle the requests.

Even though it is a good idea to have your own web server to host your web sites, it involves lot of efforts to manage the server and ensure it is accessible to the outside world all the time. Also, it is expensive to buy a high configuration server computer with backup mechanisms, UPS and a high speed internet connectivity. You must be watching your server frequently to ensure it is working fine all the time. 

ASP.NET - Installing and configuring IIS

This article guides you on installing and configuring IIS on your machine. IIS is a required a tool to develop and ASP.NET applications in your machine. 

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.

To install IIS, go to the "Control Panel" and select "Add Remove Programs". Select the option "Add/Remove Windows Components". Make sure the option "Internet Information Services (IIS)" is selected. If it is already selected, that means you already have IIS ! If the checkbox for IIS is not checked, select it and press the "Next" button to proceed to install.



The Windows Components Installation Wizard may prompt you to insert the CD for WIndows. So, keep the Windows CD handy. Or, if you have the I386 folder copied in your hard drive, you can use that when you are prompted to insert the CD.

Thursday, 22 May 2014

JDK 7 and NetBeans IDE 8.0 Installer FREE Download



NetBeans IDE 8.0 provides out-of-the-box code analyzers and editors for working with the latest Java 8 technologies--Java SE 8, Java SE Embedded 8, and Java ME Embedded 8. The IDE also has a range of new enhancements that further improve its support for Maven and Java EE with PrimeFaces; new tools for HTML5, in particular for AngularJS; and improvements to PHP and C/C++ support.

NetBeans IDE 8.0 is available in English, Brazilian Portuguese, Japanese, Russian, and Simplified Chinese.
 
 




























Wednesday, 21 May 2014

ASP.NET - Infrastructure to develop a web application


This chapter explains what are the infrastructure you need to develop a web application.

So, ready to develop a web site?

Any one who want to develop a web application must have the following systems:

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 situation, 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.

Since this tutorial is guiding you to develop web sites using ASP.NET, all the tools we are going to talk here will be the ASP.NET specific tools.

Web Server

There 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.

Editor to develop web pages

Ideally, you do not need any special editor to develop a web application. If you are an expert, you can simply use ntoepad to type HTML and the code for the web pages. However, who 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.

Browser

You 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 program

A 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.

Software

Course Books

 

© 2014 UT School | Ogranized by : Ch. Kashif Nadeem - 03336331850 |Templateism

Back To Top