Ziff-Davis Enterprise 
DevSource: Microsoft Developer Resource
Add OnsArchitectureLanguagesTechniquesUsing VSForums
 
Home arrow Languages arrow Getting Started with ASP.NET
Getting Started with ASP.NET
By Jeff Cogswell

Rate This Article:
Add This Article To:
Getting Started with ASP.NET
( Page 1 of 4 )

ASP.NET makes web development incredibly easy. This article shows you how to get started with it.

Ready to get started with ASP.NET? Great! Here's what you'll need.

  1. If you don't yet have the Microsoft .NET 2.0 runtime, download and install it here.
  2. If you don't already have Visual Studio 2005, then download and install the free Visual Web Developer 2005 Expression Edition tool also here.

Visual Studio 2005 and Visual Web Developer both come with a free web server that you can use if you don't already have the IIS web server. (If you're using XP Home Edition, you probably don't have the IIS web server.)

ADVERTISEMENT

Processing Server-side ASP.NET Code

A web browser is capable of displaying pages written in HTML. When you create an ASP.NET page, you can mix programming code inside the HTML page. The Web server will run this code before creating the final HTML page that gets sent off to the browser.

This code inside the page can be written in C# or VB.NET, and the code can do internal processing (such as reading and writing to a database) or it can generate HTML that will be sent to the browser.

Remember, when you're browsing the web, there are two sides: The browser (or client) and the web server. The web server is typically elsewhere, out on the internet. With ASP.NET, the C# or VB.NET code runs on the web server. The web server then generates an HTML page that gets sent down to the browser. The browser never sees the C# or VB.NET code; the code runs server-side.

Additionally, you can have controls inside your ASP.NET pages that ultimately generate HTML, but provide processing on the server as well. Later in this article you'll see some samples of such controls.

Creating an ASP.NET project

To get started, you need to create a project in either Visual Studio 2005 or Visual Web Developer.

  1. Click FileNew Web Site. In the New Web Site dialog, choose the ASP.NET Web Site icon, as shown in in the figure to the right.
  2. In the Language drop down, choose your prefered language. (In this article I'm using C#.)
  3. If you want to use the built-in web server, then in the Location drop down, choose File System. In the Text box, type or choose a directory on your computer that will hold your web site. (In this example, I'll use c:\website1.)
  4. Or, if you want to use your IIS server, in the Location drop down, choose HTTP. Then, instead of typing anything into the Text box, I recommend clicking the Browse button, which will open a dialog that will help you create a site on your IIS server. In the dialog, click Local IIS. Then click on Default Web Site in the tree on the right. Click the Create New Virtual Directory icon in the upper-right corner. (The middle icon.) Provide an alias name. (This is the name that will appear in http://localhost/AliasName.) Also provide a directory (i.e. folder) to hold the site; all this is shown in the figure on the left. Click OK. Then find your new site in the tree and click on it. Then click OK to return to the New Web Site dialog box.
  5. Click OK to create the web site.

Since most readers learning this at home might not have access to the expensive tools, in this article, I'm using the free Visual Web Developer and the built-in web server (shown in the figure to the left, after the project was created).

The left side of the window is the Toolbox, which contains server-side controls. (We'll explore them in the second example in this article.) The middle of the window is the code editor. On the right side is the Solution Explorer, which shows the folders and files in your project. Below that is the properties window. (You can rearrange these windows to your linking.)



 
 
>>> More Languages Articles          >>> More By Jeff Cogswell
 



DevSource video
Devsource Video Series
Manipulating Society through Technology
Jeremy Bailenson, Director of the Virtual Human Interaction Lab at Stanford University, talks about virtual reality, avatars, Moore's law, how real world behaviors influence online reality, and societal manipulation through technology!
>> Play video
>> Read article
>> See all videos
DevLife Blog
Julia shows you some wicked cool use of LINQ!
MSDev Blog
Is the latest Delphi product, RAD Studio 2007, really necessary?
Make it Work
.NET makes runtime type checking a breeze. See what Peter has to say about it in this week's tips!
News
Microsoft Counts on App Support for Vista
Microsoft has taken pains to demonstrate that Windows Vista will have ample application support.
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.