Signup · Login
Stardeveloper.com  
Home · Articles · Forums · Advertise · Contact
Article Categories
.NET  .NET
  ASP (15)
  ASP.NET (26)
  ADO (16)
  ADO.NET (10)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)
Latest Forum Activity
what is the right code to link the asp page t..
by amylisa on 22 Jul 2008 Go To Post

Can Loader.asp Get Form Elements
by azziham on 14 Jul 2008 Go To Post

Good asp resource sites
by codemylife on 3 Jul 2008 Go To Post

Re: Unable to insert data in an Access databa..
by asia on 3 Jul 2008 Go To Post

Re: problem with do while loop
by idsanjeev on 30 Jun 2008 Go To Post

Log In
UserName Or Email:

Password:

Auto-Login:

Miscellaneous Links
  Submit Article

Hosted by Securewebs.com
 
Home : .NET : ASP.NET : Your first ASP.NET page
 

Your first ASP.NET page
by Faisal Khan.

Overview
ASP.NET is an exceptionally remarkable technology for building web applications. We begin exploring ASP.NET pages with this first article. In this article we'll learn :

  • From where to download ASP.NET premium edition?
  • The installation process.
  • Developing your first ASP.NET page.
  • Running and testing your ASP.NET page.

Where to get ASP.NET premium edition?
To run ASP.NET pages you need to download and install Microsoft ASP.NET Premium Edition. ASP.NET premium edition contains CLR ( Common Language Runtime ), .NET Framework Libraries, ADO.NET and compilers for C#, VB.NET and JScript.NET languages.

To download ASP.NET premium edition, go to ASP.NET home page and follow the link which says "click here to download ASP.NET Beta 2". The download is approximately 18 MB in size and should not take long on any connection.

The installation process
The installation for ASP.NET premium edition is pretty simple ( since there is no documentation and samples ). Make sure you close all open windows and applications before starting ASP.NET setup program.

The setup for Beta 2 works much better than that of Beta 1 and you should be able to install it easily on your system. Once you have successfully installed it then move forward.

Developing your first ASP.NET page
Although VisualStudio.NET Beta 2 is available with intellisense technology to help you develop ASP.NET applications quickly, there is no reason why you cannot develop ASP.NET pages using simple Notepad ( this is what I do! ).

The root directory for ASP.NET pages is the same as that of simple ASP pages running under IIS. For example's sake, we'll assume that your root directory for ASP pages is C:\inetpub\wwwroot. Make a new directory with name of "NET" under this root directory. This new directory is *not* needed but it is still better to keep ASP.NET pages separate from ASP pages.

In that C:\inetpub\wwwroot\NET folder create a new ASP.NET page with name of firstPage.aspx ( notice the .aspx extension ). To be able to run both ASP and ASP.NET pages side by side, ASP.NET pages have a separate extension; .aspx. Also keep in mind that we are using C:\inetpub\wwwroot for example's sake, you can easily substitute it with your real root directory.

firstPage.aspx ASP.NET page
Copy and paste the following C# ( ASP.NET ) code in the firstPage.aspx page and hit the save button :

<%@ Page Language="C#" %>
<html>
<head>
	<style>
	p { font-family:Tahoma, Sans-Serif; font-size:10pt; }
	</style>
</head>
<body>

	<p align="center">
		Congratulations! this is your first ASP.NET page.
	</p>

	<p align="center" style="background-color:#F7F7F7;margin:0,100,0,100;">
	<%= System.DateTime.Now.ToLongDateString() %>
	</p>

</body>
</html>

Explanation
Most of the code above is simple client-side HTML. I'll explain the few lines of ASP.NET code in it. Notice the first line? this line is a Page directive which tells the ASP.NET translator that this page will be using C# language so use the C# compiler to compile this page.

<%@ Page Language="C#" %>

You can use any of the three languages ( C#, VB.NET & JScript.NET ) provided with the ASP.NET premium edition to develop ASP.NET pages. Since C# is pretty close in syntax to Java, I'll be using C# in all the code samples on Stardeveloper from now onwards.

Next we write the current date to the user screen using System.DateTime class's static property Now's ToLongDateString() method.

	<%= System.DateTime.Now.ToLongDateString() %>

Like classic ASP pages, <%= is equivalent to Response.Write() in ASP.NET pages. So anything between the <%= and %> tags will be written on the user screen.

Running and testing your ASP.NET page :
To run firstPage.aspx page, open your browser and enter something like http://localhost/net/firstPage.aspx in the URL box and hit enter. If all goes well, you should see something like following on your screen :

firstPage.aspx
firstPage.aspx

 ( No Further Pages )

Related Articles
  1. File Uploading in ASP.NET Using C#
  2. Sending e-mail with attachments from an ASP.NET page
  3. Browser Capabilities Component in ASP.NET
  4. Sending E-Mails using ASP.NET
  5. A Preview of Active Server Pages+
  6. Exposing Web Services
  7. Get Detailed Information About Your Site Visitors In Real Time using ASP.NET
  8. ASP.NET Website Programming: Problem - Design - Solution : Deploying the Site
  9. How to determine what server is given web site running on using ASP.NET?
  10. Sending Mass E-Mails using ASP.NET

Comments/Questions ( Threads: 2, Comments: 2 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. The Microsoft Jet database engine cannot open the file
  2. need help on setup to run aspx page

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2008 Stardeveloper.com, All Rights Reserverd.