HOW TO: Create a Local Web Server ASP.NET Application

For additional information about how to perform this task by using Microsoft Active Server Pages, click the article number below to view the article in the Microsoft Knowledge Base:

301184 HOW TO: Create a Visual InterDev Project



This article describes how to create a local Web Server ASP.NET application.

Create a Local Web Server ASP.NET Application

  1. Start Microsoft Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. In the New Project dialog box, click Visual Basic Projects under Project Types, and then click ASP.NET Web Application under Templates to create the project in Visual Basic.

    NOTE: Alternatively, you can click Visual C# Project under Project Types, and then click ASP.NET Web Application under Templates to create the project in Visual C#.
  4. In the IIS Web folder (which is typically /wwwroot), create the essential project references and files to use as a starting point for your application:
    • AssemblyInfo (.vb file for Visual Basic or .cs file for Visual C#): Use this file to describe the assembly and to specify version information.
      using System.Reflection;
      using System.Runtime.CompilerServices;
      [assembly: AssemblyTitle("")]
      [assembly: AssemblyDescription("")]
      [assembly: AssemblyConfiguration("")]
      [assembly: AssemblyCompany("")]
      [assembly: AssemblyProduct("")]
      [assembly: AssemblyCopyright("")]
      [assembly: AssemblyTrademark("")]
      [assembly: AssemblyCulture("")]
      [assembly: AssemblyVersion("1.0.*")]
      [assembly: AssemblyDelaySign(false)]
      [assembly: AssemblyKeyFile("")]
      [assembly: AssemblyKeyName("")]
    • Global.asax: The basic file Global.asax.cs that contains code for responding to application-level events that ASP.NET raises.
      <%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication2.Global" %>
      NOTE: The source of Global.asax.cs is not included in this document.
    • Styles.css: This file contains the default HTML style settings.
    • Web.config: This is an application configuration file that contains settings that are specific to an application. This file contains configuration settings that the common language runtime reads (such as assembly binding policy, remoting objects, and so on), and settings that the application can read.
    • Projectname.vsdisco: This is an XML-based file that the ASP.NET dynamic XML Web service discovery process uses to identify searchable paths on the Web server.
    • WebForm1.aspx: This file contains the portion of the default Web Forms page that contains user interface elements (controls), similar to an HTML page.
      <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" 
      AutoEventWireup="false" Inherits="WebApplication2.WebForm1" %>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
      <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
      <meta name="CODE_LANGUAGE" Content="C#">
      <meta name=vs_defaultClientScript content="JavaScript">
      <meta name=vs_targetSchema
      <body MS_POSITIONING="GridLayout">
      <form id="Form1" method="post" runat="server">
    • Webform1 (.vb file for Visual Basic or .cs file for Visual C#): This file contains a class file for the default Web Forms page that contains the system-generated and user code for the page.
  5. After you create the project, you see an empty Web Form with that is named "WebForm1.aspx." This is the workspace of the first page in a project, in which you can place WebForms, HTML forms, Components, Data objects, and Clipboard elements from ToolBox.

Create the Project

WARNING: After you create this page, you have to build the application. If you do not, you receive the following error messages:

Server Error in '/WebApplication2' Application
Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'WebApplication2.Global'
Source Error:
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication2.Global" %>
Source File: c:\inetpub\wwwroot\WebApplication2\global.asax Line: 1

Browse the Project

After the system works correctly, browsing the page that you created displays the location that you entered in the Creating Project dialog box.

For this example, the following location is displayed: