ASP.NET WebForms에서 콘텐츠 유형을 어떻게 지정합니까?
-
05-07-2019 - |
문제
DocType을 XHTML Strict로 지정하지만 텍스트/HTML의 콘텐츠 유형으로 와이어를 통해 전송되고 있습니다. 컨텐츠 유형이 Application/XHTML+XM임을 지정하고 싶지만 응용 프로그램 내에서 어디에서 구성 할 수 있는지 알 수 없습니다.
해결책
다른 팁
파일 뒤에있는 코드에서 Page_load 이벤트 중에 다음 코드를 추가하십시오.
Response.Clear()
Response.ContentType = "application/xhtml+xm"
========= ASPX ==============
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<asp:literal runat="server" id="dt"></asp:literal>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
============== CODE 뒤에 =========
protected void Page_Load(object sender, EventArgs e)
{
this.dt.Text= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
}
제휴하지 않습니다 StackOverflow