We have just discussed how to create a new web application in IIS using its own internal tools and wizards. We will now repeat the process using the Web Matrix development tool. The approach using Web Matrix is slightly different to that when using IIS; with Web Matrix we will first create our web page and then Web Matrix will create the web application to hold the page. To create your first web application using Web Matrix complete the following:
1. Open the Web Matrix by double clicking the icon on your desktop; once Web Matrix opens you should be presented with a view similar to that in Figure 3.
Figure 3 |
If you can’t see the “Add New File” dialog box when the application opens you may need to open it by selecting “New File” from the “File Menu”. The “Add New File” dialog can be seen in more detail in Figure 4.
Figure 4 |
2. If it’s not already selected under templates select “General” and on the right hand side select “ASP.Net Page”.
3. Next you need to specify the location where your application files will be stored; this will be the eventual location of your virtual directory on IIS.
4. Click on the browse button to the right side of the “Location” box and browse to the location where you want to store your application files. Note if you need to create a new folder for these files you can do so using the “Make New Folder” button from the “Browse For Folder” dialog box. For the purposes of my project I will create a folder on the C Drive called “rras”. (If you have already followed through the first part of this tutorial you will need to delete the sub web that you created earlier or use a different folder name for this exercise.)
5. Now change the name of the file in the “Filename” box to default.aspx and check that Visual Basic .Net is selected next to language as this is the language in which we will be working.
6. Once you are happy that all the settings have been entered correctly click on “OK” and the Web Matrix will create your first ASP.Net web page and put it into the folder that you have specified above. The page will be open in the editor ready for you to start working with it.
If you look at the new page that you have created you will notice that there are four tabs along the bottom edge, each of which will provide you with a different view of the web page. They are as follows:
· Design - which provides you with a WYSWYG view of your web page.
· HTML - which provides you with a view of the web pages’ HTML code.
· Code - which provides you with a view of the web pages’ programme code.
· All - which provides you with a view of the web pages HTML and programme code.
Make sure your new web page has Design view selected and then type “This is my first web application” on to the page before pressing Return on your keyboard. If you change view to HTML view you will see that Web Matrix has created some simple HTML code for you.
At this stage you still only have a single ASP.Net web page created within a folder on your hard drive and as we have stated before, in order to view an ASP.Net web page in a web browser we have to first run it through a web server so that any scripts can be processed. To do this complete the following:
1. Select “View” and then “Start” from the File menu (or press F5 on your keyboard) to launch the “Start Web Application” dialog box. This is shown in Figure 5.
Figure 5 |
2. Select “Use or create an IIS Virtual Route” and in the “Application Name” box provide your application with a name. I will use “rras” for my project.
3. Once you are happy that you have entered the information correctly click “Start” and Web Matrix will create a “Virtual Directory” within IIS based on your project folder and then launch Internet Explorer with which to view your newly created web page. Note you may be prompted for appropriate Username and Password details for the web server.
If you want to see what has been completed you can close the web page, minimise Web Matrix and then open the IIS Management Console using the short cut on your desktop. You should then see your newly created Virtual Directory listed below the Default Web Site. You can also check the path for the application files and this will be same as the folder you created earlier to store your new pages in. Note also that during this process (at Stage 2) we elected to “Use or create an IIS Virtual Route” and therefore to use IIS as our web server. At this stage we could have elected to use Web Matrix’s own in built web server to view our new web page.
| <<Creating our first website in IIS |
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.
Get your best asp web hosting provider now and save 25%