开发者

Asp.net closes meta tag incorrectly in html 4.01

开发者 https://www.devze.com 2023-01-27 03:01 出处:网络
My project is an asp.net开发者_StackOverflow-mvc 2 project using the default webforms view engine.

My project is an asp.net开发者_StackOverflow-mvc 2 project using the default webforms view engine.

The master page contains the following in the head tag:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

This is valid Html 4.01 and shouldn't contain a trailing self-closing tag (it's not xhtml).

When I run this page however, it gets rendered as follows:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

What am I doing wrong?


Reflector would indicate that this is by design and not to be fixed ... unless you EnableLegacyRendering (which I have no experience with so there's that).

protected internal override void Render(HtmlTextWriter writer)
{
    if (base.EnableLegacyRendering)
    {
        base.Render(writer);
    }
    else
    {
        writer.WriteBeginTag(this.TagName);
        this.RenderAttributes(writer);
        writer.Write(" />");
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消