Tony Patton describes what's included in a new ASP.NET Web Forms site created with Visual Studio 2013.
One interesting aspect of each new version of Microsoft's flagship IDE Visual Studio is how projects are created — that is, what is included and how resources and files are organized. You can learn a lot about the product as well as the underlying platform by examining what is offered. Here's a look at what is included in a new ASP.NET Web Forms site created with Visual Studio 2013.
Starting from scratch
There are a variety of ways to create a new site with Visual Studio 2013, but I will follow the most straightforward path for this article. Figure A shows choosing New Web Site from the File menu, which presents the New Web Site window (Figure B). For the purposes of this article, I choose ASP.NET Web Forms Site from the templates presented in Figure B. Once the selection is made, the disk drive churns while the ASP.NET 4.5 site is created with the results shown in Figure C.
Creating a new website in Visual Studio 2013
The various options for creating a new website.
The ASP.NET Web Forms site created by Visual Studio 2013.
Now that the project is created, let's take a closer look at what is included.
What are all of these files?
- Account: This directory contains the web pages used to provide authorization. It is the security and logon files, so there are files for user registration (Register.aspx), managing an account (Manage.aspx), logging in (Logon.aspx), and more.
- App_Code: This is where shared source code (things like shared classes or business objects) should be created. By default, there are classes for working with Friendly URLs (routes) and ASP.NET Identity features as well as others.
- App_Data: This folder contains application data files like XML or other data stores. It is empty when a project is created by Visual Studio 2013.
- bin: This contains all of the compiled assemblies referenced by the application and the application itself. When the project is created, it is populated by all of the DLLs used by the application. This includes ASP.NET Identity, Entity Framework, OWIN, WebGrease, and many more (Figure D).
- Content: This is where the Bootstrap and other CSS files are stored. You will most need to create your own CSS for new features or to override default settings, so CSS should be placed in this directory.
- fonts: Any special fonts to be used by the application are here. By default, the Bootstrap offerings are included.
The contents of the bin subdirectory for a newly created project.
The contents of the Scripts subdirectory for the website.
As for the files on the site, there are web pages for content (About.aspx, Contact.aspx, and Default.aspx for the home page) and the standard ASP.NET application file (Global.asax). Figure F shows the site loaded (the default page), which clearly demonstrates a standard Bootstrap layout. The following list provides more details on the remaining files in the base project directory.
- favicon.ico: A standard website feature that allows you to associate an icon with the site.
- packages.config: This file is used to track installed packages and respected versions.
- Site.master: The master page for the site.
- Site.Mobile.master: The mobile master page for the site.
- ViewSwitcher.ascx: This control can be used on pages to allow users to switch between desktop and mobile versions of a page. The control can be placed on a page or in the master page for all pages, and the user will have links for switching to mobile version or desktop if viewing on a mobile device.
- Web.config: The configuration file for the site. A review of this file shows references to Entity Framework, WebGrease, and ASP.NET Identity included by default.
The default page of the standard ASP.NET Web Forms site loaded in Chrome.
What does it mean?
A review of what is included with our project gives us a glimpse of the new .NET technologies as well as Microsoft's vision of web development. It may not be a surprise that new or enhanced features like the ASP.NET membership system (ASP.NET Identity), OWIN, and the Entity Framework are included by default, but I found it interesting to see DLL files for ANTLR and WebGrease and the Web.Optimization namespace as well. It seems Microsoft is serious about improving the performance of its platform and user experience, and the fact the company is embracing web standards and frameworks is wonderful.
While this article only scratches the surface of ASP.NET web development with an overview of a basic website, I hope it provides a starting point for asking lots of questions and learning more.