How to Use the Empty Site Template for ASP.NET Web Pages

 

WebMatrix templates get you started with creating a website. The Empty Site template lets you create a website that has minimal functionality to start with. You typically choose this template if you want to create your own layout and add your own features like login.

This article walks you through the following:

· How to create a site from the WebMatrix Empty Site template for ASP.NET Web Pages.

· An overview of the template contents.

· Suggestions for tasks to get started with the site that’s created by the template.

Create a site from the Empty Site template

1. In WebMatrix, select File –> New –> Site from Template Gallery.

2. In the ASP.NET category, select Empty Site.

3. In the Site Name box, enter a name and then click Next.

clip_image002

That’s it! You can now start customizing your website.

Site Contents

The template builds a site that contains the following:

App_Data folder

The App_Data folder is where you put any databases or data files that your application uses. However, by default the site contains no database (not even an empty database). The App_Data folder does contain components (NuGet packages) that are required for all ASP.NET Web Pages sites.

bin folder

This folder contains the executable files (DLLs, assemblies) that are part of ASP.NET Web Pages. If you install new components (NuGet packages), the executable files for those components (if any) are installed in this folder.

Default.cshtml file

This is the site’s home page. It’s the file that’s displayed if users go to your site and don’t request a different page. In the Empty Site template, the Default.cshtml page is a simple HTML page that renders no visible markup. The page contains an empty Razor code block (@{ }). If you run the site, you see a blank page in the browser.

In WebMatrix you can change which page is displayed by default by going to the Site workspace, selecting Settings, and entering or selecting a new page under Manage Default Pages.

robots.txt file

This file is used by search-engine crawlers to determine what files in the site to index. You can modify this file if you want to specify files to exclude from indexing or make other changes. For more information, see The Web Robots Pages.

Note  Search-engine crawlers usually read and honor the robots.txt file, but the file is not designed as a security measure. Do not use the robots.txt file as a way to try to hide files.

Getting Started Tasks

Unlike the other WebMatrix templates, the Empty Site template does not have a set of typical tasks associated with it. You typically choose the Empty Site template if you want to build the site yourself from scratch.

For ideas about tasks you can perform in ASP.NET Web Pages sites, see Introducing ASP.NET Web Pages 2.

You can discuss this article using the adjacent Facebook talkback.

For technical questions please visit our discussion forums, where we have a vibrant community of developers like you, as well as Microsoft engineers who are ready to answer your questions!