如何在ASP.NET WebForms中指定内容类型?

8 asp.net webforms content-type xhtml-1.0-strict

我将我的doctype指定为xhtml strict,但它是作为text/html的内容类型通过网络发送的.我想指定内容类型是application/xhtml + xm,但我无法弄清楚我可以在我的应用程序中配置它的位置

Mit*_*ers 15

您可以在@ page attributes部分中指定它,如下所示:

<%@ Page ContentType="application/xhtml+xm" %>
Run Code Online (Sandbox Code Playgroud)

...更多关于MSDN.

  • [为什么仅链接答案是个坏主意]的典型例子(http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers).除非你按照链接,答案实际上没有回答这个问题.链接死了,使答案完全没用.我修复了它 - 通过修复链接(现在),但更重要的是通过实际将答案**放在答案中. (3认同)