Asp.net错误地关闭元标记HTML 4.01 [英] Asp.net closes meta tag incorrectly in html 4.01

查看:107
本文介绍了Asp.net错误地关闭元标记HTML 4.01的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是使用默认web表单视图引擎一个asp.net-MVC 2的项目。

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">

这是有效的HTML 4.01,不应包含尾随自闭标签(这不是XHTML)。

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?

推荐答案

反射将表明这是设计而不是固定......除非您EnableLegacyRendering(我没有经验,所以有这一点)。

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

这篇关于Asp.net错误地关闭元标记HTML 4.01的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆