File System Web Site Projects

Visual Studio lets you keep the files for your Web site project 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 project. File-system Web site projects 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 Studio 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 project, you specify a location for the web site files. You can specify a folder on your hard disk or a shared folder on another computer. Visual Studio will create the folder, if necessary, and populate it with the files from the Web site project template that you have selected. For example, if you create a Web site project by using the ASP.NET Web Site template, Visual Studio creates a default pages such as Default.aspx and default folders such as App_Data 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 project files in a folder already, you can open a Web site project by specifying the folder as the location.

Visual Studio Project Files in File-System Web Site Projects

A Web site project does not have a Visual Studio project file. Instead, Visual Studio considers all of the files and folders that are located in a given folder as part of the same project. For more information, see Web Application Projects versus Web Site Projects in Visual Studio.

File-System Web Project Folder Structure

The folder structure of a file-system Web site project is the same as for any other ASP.NET Web site project. Web pages can appear in the root folder or in any subfolder of the site. As with other types of Web site projects, ASP.NET and Visual Studio 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 Project Folder Structure and Shared Code Folders in ASP.NET Web Site Projects.

Testing File-System Web Site Projects

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 project in Visual Studio, Visual Studio uses the Visual Studio Development Server as the Web server. This 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 more information, see Web Servers in Visual Studio for ASP.NET Web Projects.

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 Visual Studio Development Server. For details, see How to: Specify the Web Server for Web Projects in Visual Studio.

Authorization Behavior on File-System Web Site Projects

If you test your file-system Web site project using the Visual Studio Development Server, static files such as images and style sheets are subject to ASP.NET authorization. For example, if you are testing your site as an anonymous user (without logging in to the application), and if the application is configured to restrict access to files in a folder, the Visual Studio Development Server will not serve any static files in that folder. 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 Site Projects

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 Studio. For more information, see Web Deployment Content Map for Visual Studio and ASP.NET.

If you are developing your file-system Web site project 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 Studio.

See Also

Tasks

How to: Create File System Web Site Projects

How to: Specify the Web Server for Web Projects in Visual Studio

Concepts

Types of Web Site Projects in Visual Studio

Other Resources

ASP.NET Web Projects

Web Application Projects versus Web Site Projects in Visual Studio

Web Servers in Visual Studio for ASP.NET Web Projects

Web Deployment Content Map for Visual Studio and ASP.NET