ASP.NET/Your First Page

Your First ASP.NET Page

No programming book is complete without a Hello World example as the first project/example.

In ASP.NET creating a quick Hello World example is painless and easy. At the same time we are going to explore the structure of a basic ASP.NET page.

Let's look at the basic structure of an ASP.NET page. Doing so will give us a chance to introduce several important aspects relevant to coding ASP.NET pages.

VB.NET

<%@ Page Language="VB" %>

C#

<%@ Page Language="C#" debug="true" trace="false"%>

As you can see, an ASP.NET page has a lot in common with a regular HTML-based page. Now in order to make our Hello World example we just need to add one line of code to the above examples.

VB.Net

      Sub Page_Load()
        'On Page Load Run this code
        Response.Write ("Hello World")
      End Sub

C#

      void Page_Load() {
        //On Page Load Run this Code
        Response.Write("Hello World");
      }

Copy the original code into a new file with the extension aspx. Then make the above modification. When the file is run, assuming it is being hosted on an ASP.NET compatible web server, you will see the words Hello World on your web browser when you access the page.

Next Chapter: Examining The Page Structure

This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.



ASP.NET/Your_First_Page
 

Manage research, learning and skills at IT1me. Create an account using LinkedIn to manage and organize your IT knowledge. IT1me works like a shopping cart for information -- helping you to save, discuss and share.


  Contact Us  |  About IT1me.com |  IT Training & References |  IT Careers |  IT Hardware |  IT Software |  IT Books