Meta tag modification

  • Thread starter Maziar Aflatoun
  • Start date
M

Maziar Aflatoun

Hi everyone,

My goal is to modify the contents of my meta tag (html refresh). However,
my code adds a new instance of the meta tag at the bottom of the page. Is
there a way to modify it instead of adding a new one?

<head>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
<meta id="MyRefresh" http-equiv="refresh" runat="server" />
</head>

Code:
private HtmlGenericControl baseDescription;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
baseDescription = new HtmlGenericControl("meta");
baseDescription.ID = "MyRefresh";
baseDescription.Attributes["http-equiv"] = "refresh";
baseDescription.Attributes["content"] = "10;url=http://www.google.com/";
this.Controls.Add(baseDescription);
}

It produces this
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
<meta id="MyRefresh" http-equiv="refresh"></meta>
</head>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwyMDQ4ODY2NTc4Ozs+TOEvvBKAHbIZ9zIwcQpj+TlnFX8=" />


</form>
</body>
</html>
<meta id="MyRefresh" http-equiv="refresh"
content="10;url=http://www.google.com/"></meta>Thank you
Maz.
 
L

Lucas Tam

Is
there a way to modify it instead of adding a new one?

You can place a label or place holder in the meta tag, then output data to
the placeholder or label.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top