The freely available tool WebMatrix, which I used on my old pc to develop ASP.NET pages several years ago, came with a built in webserver, code named Cassini, so a developer could test his/her pages on the localhost.
With the .NET 2.0 framework this localhost only webserver's shipped and if you don't have Visual Studio 2005, or the free Visual Web Developer Express Edition tool (which is the follow up of WebMatrix), you can still execute your pages and view the outcome in a browser.
Here's a little guide on how to proceed:
Create a folder on your hard drive. In this example I created c:\MyASPNETPages\ where my testpage will reside. The testpage itself contains this code:
1 <%@ Page Language="C#" %>
3 <script runat="server">
5 protected void Page_Load(object sender, EventArgs e)
7 Label1.Text = DateTime.Now.ToShortDateString();
13 <head runat="server">
14 <title>Test Page</title>
17 <form id="form1" runat="server">
19 <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
Now start up a DOS box (Start | Run, type in cmd followed by enter). Navigate to the folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
If you don't know how to do this you can type in the following in the opened DOS box:
After that you can type in the text in bold:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>webdev.webserver /port:8088 /path:
Ok what does this mean?
webdev.webserver is the executable itself with the following arguments: port, path and vpath. Port and vpath are optional parameters. After typing the previous lines in bold in and pressing enter a webserver starts up (Figure 1):
Figure 1: Started up webserver
From Figure 1 we can also see what our url will look like (http://localhost:8088/Test).
This demonstrates the purpose of the port and vpath arguments. Port is the port number on which the server will listen. The default is 80 but if you have IIS running, like me, it's better to use another number or they will conflict.
After starting the webserver I can easily navigate to my webpage by typing in the url in the address bar of my browser: http://localhost:8088/Test/
As you would've expected I get to see the current date displayed in my page.
If I ommit the vpath argument it would default to "/", meaning that I can navigate to my pages by just typing in this in the address bar: http://localhost:8088/test.aspx