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
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
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?