Boris Callens
Boris Callens

Reputation: 93357

Asp.net closes meta tag incorrectly in html 4.01

My project is an asp.net-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?

Upvotes: 1

Views: 376

Answers (1)

jcolebrand
jcolebrand

Reputation: 16035

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(" />");
    }
}

Upvotes: 1

Related Questions