{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
First Web Program (Web Site) in C# Explained
Summary
This article explains and dissects the pieces involved in creating the first web program in C# using the Web Site method (as opposed to the Web Program method).
 
Table of Contents

What is a web program in C#?

Creating a Web “Site”

Figure 1. Creating a new web site

Generated Files

Figure 2. Solution Explorer for the Web Site

Other Articles

 
Article Series
Previous Article:
Test Your Knowledge: First Web Program (Web Project) in C# Explained
This article is part of the Series:
Article Series: First Programs in C# Explained
Next Article:
Test Your Knowledge: First Web Program (Web Site) in C# Explained

What is a web program in C#?

Creating a web program / application in C# includes using ASP.NET. The pieces (namespaces, classes, etc.) from the .NET Framework that provide web development functionality are called ASP.NET.

So, enormous amount of basic functionality that is needed for creating a web site or web project or web program is already available in the ASP.NET library (a collection of namespaces, classes, etc. from the .NET Framework). You will use the C# programming language to access that built-in functionality or develop your own custom functionality that makes your site stand out.

You can create a new web program using C# (and .NET/ASP.NET, Visual Studio 2008) in two different ways:

Creating a Web “Project”

Creating a Web “Site”

In this article, the Web Site solution is discussed. And in the following article, the Web Project solution is discussed:

First Web Program (Web Project) in C# Explained

And the following article discusses when is it appropriate to use a Web Project vs. Web Site:

Which one to use: Web Project or Web Site?

Creating a Web “Site”

Now let’s look at another way of creating a new web application/program: Choosing Web Site.

In order to create a new web site, use File-New-Web Site menu. The dialog box you are presented with is markedly different from the Web Project dialog box.

Figure 1. Creating a new web site

Figure 1. Creating a new web site

As shown in Figure 1, choose the ASP.NET Web Site template to create a new web site.

You can save the web site to a local directory (which is typically what you would do) or to a server (some remote machine) via HTTP or FTP.

By default, the available code behind languages (the functionality for the site is developed in this language) are Visual C# and Visual Basic. Other programming languages like IronPython might also be available if you install them.

Generated Files

Now, let’s take a look at the files generated for the Web Site solution.

Figure 2. Solution Explorer for the Web Site

Figure 2. Solution Explorer for the Web Site

As shown in Figure 2, you won’t see a Project file (.csproj), as you would see in case of the Web Project solution (as discussed in the article: ). So, underneath the Solution (FirstWebSite) in the above figure, you will see a directory, not the name of a Project.

Other than that difference, the generated files are the same in both cases (Web Project and Web Site solutions). The main files being Default.aspx.* and web.config.

For a more detailed discussion of these generated files, code discussion, and running a sample program, refer to the following Web Project article:

First Web Program (Web Project) in C# Explained

Other Articles

In this article, the Web Site solution is discussed. And in the following article, the Web Project solution is discussed:

First Web Program (Web Project) in C# Explained

And the following article discusses when is it appropriate to use a Web Project vs. Web Site:

Which one to use: Web Project or Web Site?

Take a Quick Quiz on this Article

1. The web development functionality in .NET Framework is branded as:



: Before .NET, the branding was Active Server Pages.
Question 1 of 5
Article Series
Previous Article:
Test Your Knowledge: First Web Program (Web Project) in C# Explained
This article is part of the Series:
Article Series: First Programs in C# Explained
Next Article:
Test Your Knowledge: First Web Program (Web Site) in C# Explained
Bookmark and Share This

More Articles With Similar Tags
icon-first-web-new-project.jpg
This article explains and dissects the pieces involved in creating the first web program in C# using the Web Project method (as opposed to the Web Site method).
How do you develop an ASP.NET program using the Web Project model?
What is involved in developing a web-based program using the C# programming language with Web Site - Solution as the model.
This test has questions on developing first console (shell) based programs using the C# programming language.
icon-web-proj-site-dir-compare.jpg
Visual Studio 2005 and Visual Studio 2008 offer two options for creating an ASP.NET web program – a Web Project or Web Site. This article discusses the main reasons why you would choose one over the other.
About  Contact  Privacy Policy  Site Map