|
Now that you have everything setup on your computer, lets start by trying out a simple “Hello World” example. You can use any editor of choice for this example. I will prefer Notepad (or any other text editor) as you will get the opportunity to learn some additional details using it.
A Simple “Hello World” Example
Open up Notepad (or any other text-editor of choice).
Type the following lines of code into it:
Listing 1.0
<%@ Page Language=”VB” %>
<Script Language=”VB” Runat=”server”>
Public Sub Page_Load() Response.Write (“Hello World”) End Sub
</Script>
<HTML> <HEAD> <TITLE>Hello World!</TITLE> </HEAD>
<BODY> </BODY> </HTML>
I will explain the code in the next section, lets first save and test the page.
Save the page as test.aspx in the wwwroot directory.
Open your Web browser and type http://localhost/test.aspx in the address bar. (You can use anyone of the three variants – localhost, 127.0.0.1 or (computer name) - in place of localhost as mentioned earlier in this tutorial.)
The following screenshot shows how the page looks when opened in the Web browser.
Important
The results of an ASP or ASP.NET page can only be viewed by accessing them through a Web browser using a URL. You cannot run an ASP or ASP.NET page by double-clicking its icon or dragging and dropping it in the Web browser program.

Figure 14: The Hello World page.
|