ASP.NET adds an extra closing tag
Possible duplicate:
ASP.net meta tag rendering is valid
This is in my .aspx file:
<meta name="viewport" runat="server" content="width=380,height=575" id="viewPort" />
This is what appears in the rendered HTML file in the browser:
<meta id="viewPort" name="viewport" content="width=380,height=575"></meta>
Which is actually not HTML5 compliant.
Any idea why this is changing?
+3
source to share
1 answer
This behavior is obviously related to ASP.NET design:
Workaround 1: Add the following code to your page_load event:
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "keywords";
keywords.Content = "one two trhee;
Header.Controls.Add(keywords);
see the ASP.NET rendering meta tag
Workaround 2:
protected internal override void Render(HtmlTextWriter writer)
{
if (base.EnableLegacyRendering)
{
base.Render(writer);
}
else
{
writer.WriteBeginTag(this.TagName);
this.RenderAttributes(writer);
writer.Write(" />");
}
}
+4
source to share