Now you have some familiarity with the properties for the Default Web Site close this box so that you can create your first web site. As mentioned previously, if you are running the Server version of the operating systems you may choose to create a new web site in its entirety with its own IP address, but as I will assume here that you are working on the Professional versions we will create a sub web within the default web site. To create you first sub web, complete the following:
1. Right click on the “Default Web Site”, select “New” from the list and then “Server Extensions Web”. This will launch the “New Subweb Wizard”.
2. Click on “Next” and the wizard will prompt you for the Directory Name and the Title. As this is a sub web of the Default Web Site this sub web will be created within a subfolder of the default website folder (which if you haven’t altered it will be c:\inetpub\wwwroot). The name you enter into the Directory Name box will be the folder name within the Default Web Site folder. The Title will be the name of the Sub Web as it appears within the IIS management console and the name that would be requested by the web browser.
I will be creating a new web site for a local Aquarist Society so I will call my Directory Name “rras” and my Title “rras” (the society initials). The folder will become c:\inetpub\wwwroot\rras and the web site could be viewed by typing http://192.168.0.2/rras into the web browser (assuming 192.168.0.2 is the IP address for this web site/my computer).
3. Click on “Next” and the wizard will prompt you for the “Access Control” for this sub web. The Access Control determines who has permission to edit and configure the web site. For this exercise we will accept the default options and use the same Administrator as for the parent web (Default Web Site). You could choose to set up new Administrators for this sub web if this was necessary.
4. Click on “Next”, check your settings and then click on “Finish” and the wizard will create your sub web for you. You should be able to view your new web site within the IIS Management Console. If you can’t immediately see it listed below the Default Web Site you may need to refresh the view by selecting the “Default Web Site” and then clicking on the “Refresh” button just under the file menu.
5. You will notice at this stage that our new sub web appears as a folder within the default web site and not as an application. We can view its properties by Right clicking on the folder and then selecting “Properties” from the list. You will notice that the properties for this sub web are a sub set of those from the parent or Default Web Site. On the “Directory” tab which equates to the “Home Directory” tab on the Default Web Site you can view the Application Settings. Note as at this stage our new sub web is not a web application. We have the option to “Create” a web application next to the Application Name which is currently greyed out. If we click on “Create” the web server converts this sub web into a web application and the Application Name is no longer greyed out.
6. Click on OK to close the properties box and our new web application is ready.
We have now created our first web application and although at this stage the application does not have any internal pages the structure is ready and those pages could be added and viewed.
To add a web page to this application you can create a basic web page using any web page creation tool (including Notepad) and copy it to our newly created folder, in my case c:\inetpub\wwwroot\rras. This web page could now be viewed by entering its details into a web browsers address bar.
For example open notepad and type the following text into a new document.
<html>
<head>
<title>My New Web Application</title>
</head>
<body>
<p>This is my first web application</p>
</body>
</html>
Save this file as default.aspx into your new sub webs folder (mine is c:\inetpub\wwwroot\rras). Ensure when saving the file you change the file type on Notepads save dialog box to all files and give the file name the .aspx extension. You can now browse this file by typing the correct address into your web browser’s address bar (mine would be http://localhost/rras/default.aspx). Localhost will be recognised on your workstation as the local web server if you don’t know the IP address.
I have explained here how to create a sub web within the Default Web Site of IIS. By following a very similar process (Selecting “Virtual Directory” at Stage 1) we could have created a Virtual Directory within IIS. The process for each is very similar and the differences between each are marginal depending upon your set up and objectives. In fact if you create both a sub web and a virtual directory and compare the properties of each side by side you will notice that the two are almost identical. The main difference being that the folder for a sub web is created within the folder of the parent web site while the folder for a virtual directory can be placed any where on your computer.
| <<Overview of IIS |
Get the best asp hosting provider from web-hosting-top.com and save up to 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.
