Created
November 21, 2012 11:00
-
-
Save WengerK/4124320 to your computer and use it in GitHub Desktop.
Dynamic change title & meta page on ASP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Title="MyTitle" Inherits="ASP1._Default" MasterPageFile="~/MasterPage.Master" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
namespace ASP1 | |
{ | |
public partial class _Default : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
Page.Title = "Hello World"; | |
// Programmatically add a <meta> element to the Header | |
HtmlMeta keywords = new HtmlMeta(); | |
keywords.Name = "keywords"; | |
keywords.Content = "master page,asp.net,tutorial"; | |
Page.Header.Controls.Add(keywords); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment