Example: Adding Application-Wide HTML Tags via Master Pages

You can add application-wide HTML tags to your application’s master pages.  These master page files are used as the basis for most of your application’s web pages.  This approach saves you from manually adding them to every page in your application.  Your application’s master pages are located the Master Pages folder, e.g.:

...\MyApp\Master Pages\HorizontalMenu.master


Step 1:  Locate the master page file, e.g.:

...\MyApp\Master Pages\HorizontalMenu.master

Step 2:  In Layout Editor, open the Page Directives dialog (Layout Editor, right-click, Page Directives…).

Step 3:  Add your ‘application-wide’ tags in the HTML’s <head> section of the master page file via the Page Directives dialog, e.g.:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

<title> </title>

<meta name="keywords" content="My Keywords">

<meta name="description" content="My Description">

<link rel="stylesheet" rev="stylesheet" type="text/css" href="../Styles/Styles.css"/>


Step 4:  Rebuild your application (Build, Rebuild All).

The new tags will be included on every page that references the updated master page.

See Also

Placing ASP.NET Directives in Application Pages