HOW TO: Create a Local Web Server ASP.NET Application
This article was previously published under Q321748
On This Page
SUMMARY
This article describes how to create a local Web Server ASP.NET 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.
Source Error:
Source File: c:\inetpub\wwwroot\WebApplication2\global.asax Line: 1
For this example, the following location is displayed:
Create a Local Web Server ASP.NET Application
- Start Microsoft Visual Studio .NET.
- On the File menu, point to New, and then click Project.
- In the New Project dialog box, click Visual Basic Projects under Project Types, and then clickASP.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#. - 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" %>
- 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" %>
WebForm1 - 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.
- AssemblyInfo (.vb file for Visual Basic or .cs file for Visual C#): Use this file to describe the assembly and to specify version information.
- 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 Message: Could not load type 'WebApplication2.Global'
Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication2.Global" %>
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:
http://localhost/WebApplication2/WebForm1.aspx
No comments:
Post a Comment