Udostępnij za pośrednictwem


File System Web Sites

Visual Web Developer allows you to keep the files for your Web site in a folder on your local hard disk or in a shared location on your local area network. This is called a file system Web site. Using such a file system Web site means that you do not need to create your site as an Internet Information Services (IIS) application to develop or test it.

File system Web sites are particularly useful in the following situations:

  • When you do not want to (or cannot) install IIS on your development computer.

  • When you already have a set of Web files in a folder, and you want to use Visual Web Developer to open them as a project.

  • In classroom settings, where students can store files on student-specific folders on a central server.

  • In a team setting, where team members can access a common Web site on a central server.

Creating or Opening File System Web Sites

When you create a file system Web site, you specify a location for the application files. You can specify a folder on your hard disk or a shared folder on another computer. Visual Web Developer will create the folder, if necessary, and populate it with the files from the Web site template that you have selected. For example, if you create a Web site by using the ASP.NET Web Site template, Visual Web Developer creates a default page named Default.aspx and an Application_Data folder in the location that you specify.

Note

You must have the appropriate permissions to create folders and files in the location that you specify.

If you have a set of ASP.NET Web site files in a folder already, you can open a Web site and specify the folder as the location. Visual Web Developer allows you to work with the folder as if you had created the Web site in Visual Web Developer.

File System Web Site Projects

In Visual Web Developer, you do not need to have a Web project file. Instead, Visual Web Developer considers all of the files and folders that are located in a given Web folder as part of the same Web project. Some of the information that earlier versions of Visual Studio stored in the Web project file is now stored in the Web.config file, the Vwd.webinfo file, or the solution file for the Web project. For more information, see Web Site Projects and Solutions.

File System Web Site Layout

The layout of a file system Web site is the same as for any other ASP.NET Web site. Web pages can appear in the root folder or in any subfolder of the application. As with other types of Web sites, ASP.NET and Visual Web Developer treat certain subfolders as special. For example, compiled assemblies in the Bin subfolder are referenced automatically in the application, source code in the App_Code folder is compiled and referenced automatically, and so on. For more information, see ASP.NET Web Site Layout and Shared Code Folders in ASP.NET Web Sites.

Testing File System Web Sites

To test a Web site, you must request the application's files by using a Web server. By default, when you run (test) a file system Web site in Visual Web Developer, Visual Web Developer uses the ASP.NET Development Server as the Web server. The ASP.NET Development Server is a server that runs locally on your computer and can serve ASP.NET Web pages, which makes it suitable for testing your application. For details about the ASP.NET Development Server, see Web Servers in Visual Web Developer.

If you prefer, you can configure your file system Web site to run files using a different server. You might do this if you have an IIS virtual directory that points to your application's folder and you want to run the pages using IIS. In some cases, running pages using IIS provides a more accurate assessment of how the application will run on a production server.

You can specify the Web server that you want to use for testing by setting the application's start options and then specifying the URL of the server that you want to use instead of the ASP.NET Development Server. For details, see How to: Specify the Web Server for Web Sites.

Authorization Behavior on File System Web Sites

In a file system Web site, static files, such as images and style sheets, are subject to ASP.NET authorization. For example, static files in a file system Web site will not be served to an anonymous user when anonymous access to those files is disabled. However, when you deploy the Web site, IIS will serve static files without using ASP.NET authorization rules. If you want to restrict access to static files, configure access rules for those files in IIS.

Deploying File System Web Sites

File system Web sites are generally used only for development, so that individual developers can create and test ASP.NET Web pages on their own computers. In most cases, you should deploy the files from a file system Web site to a production server running IIS.

You can deploy the files from a file system Web site using the Copy Web or Publish Web tools in Visual Web Developer. For more information, see ASP.NET Deployment Overview.

If you are developing your file system Web site on the computer that also hosts the production Web server, you have the option of creating an IIS virtual directory that points to your application's location, thereby exposing the files as a live Web site. For details, see How to: Create IIS Virtual Directories in Visual Web Developer.

See Also

Tasks

How to: Create File System Web Sites

How to: Specify the Web Server for Web Sites

Concepts

Types of Web Sites in Visual Web Developer

Web Servers in Visual Web Developer

ASP.NET Web Site Layout

ASP.NET Deployment Overview

Other Resources

Web Site Projects and Solutions