Export (0) Print
Expand All

Web Pages and Projects

Web Forms pages are one way to create the user interface of an ASP.NET–based Web application. You can add Web Forms pages to several types of Visual Studio projects. Most often, when you want to work with Web Forms pages, you will use the ASP.NET Web Application project template. For general information about ASP.NET Web applications, see Types of Web Sites in Visual Web Developer.

To work with a Web Forms page in Visual Studio, you use the Web Forms Designer. The designer includes a WYSIWYG view, called Design view, for laying out the elements of the page. Alternatively, you can switch the designer to an HTML view, called Source view, which gives you direct access to the ASP.NET syntax of the elements on the page. Finally, the designer includes a code editor with IntelliSense that you can use to create the page initialization and event-handler code for your page. For more information, see ASP.NET Web Pages Overview.

When you create a Web project, Visual Studio constructs a Web application directory structure on the target Web server, and a project structure on your local computer. The following table describes the files that relate to your Web Forms pages.


You need to have appropriate privileges on the Web server computer to create and manage Web application files. For details, see ASP.NET Security.

File Created


WebForm1.aspx and WebForm1.aspx.vb files for Visual Basic Web applications


WebForm1.aspx.cs files for Visual C# Web applications

These two files make up a single Web Forms page. The .aspx file contains the visual elements of the Web Forms page, for example HTML elements and Web Forms controls. The WebForm1.aspx.vb class file is a hidden, dependent file of WebForm1.aspx. It contains the code-behind class for the Web Forms page, containing event-handler code and the like. For more information, see Web Forms Code Model.

AssemblyInfo.vb files for Visual Basic projects


AssemblyInfo.cs for C# projects

A project information file (AssemblyInfo.vb or AssemblyInfo.cs file) that contains metadata about the assemblies in a project, such as name, version, and culture information. For details on data contained in the assembly file, see Assembly Manifest.

Web.config file

An XML-based file that contains configuration data on each unique URL resource used in the project. For more information, see ASP.NET Configuration Overview.

Global.asax and Global.asax.vb files


Global.asax and Global.asax.cs files

An optional file for handling application-level events. This file resides in the root directory of an ASP.NET application. The Global.asax.vb class file is a hidden, dependent file of the Global.asax file. It contains the code for handling application events such as the Application_OnError event. At run time, this file is parsed and compiled. For more information about Global.asax file usage, see How to: Handle Application-Level Errors.

Styles.css file

A cascading style sheet (CSS) file to be used within the project. For more information, see Working with CSS Overview.

The server on which you create your Web Forms pages is typically not the server on which you will deploy the pages and their associated files for production. To deploy a Web project containing Web Forms pages, you may follow one of two approaches:

  • Copy your project to the Web server.

  • Create a deployment project.

For more information about these options, see ASP.NET Deployment Content Map.



Introduction to Solutions, Projects, and Items

Provides an overview of solutions, projects, and items, and describes the advantages of using Visual Studio to manage your development projects and files.

ASP.NET Master Pages

Describes how to create a consistent page layout using a template (master page) and separate content pages.

Using Solution Explorer

Provides an overview of the Solution Explorer window and how you can use it to manage Visual Studio solutions and projects.

ASP.NET Themes and Skins

Describes how to create a consistent appearance for pages and controls by setting properties and CSS styles.

ASP.NET Authorization

Describes ways that ASP.NET provides to determine whether an identity should be granted access to a specific resource.

ASP.NET Deployment Content Map

Describes how to use deployment tools to install files on a Web server.

Community Additions

© 2014 Microsoft