ASPNET 页面编码

设置ASPNET页面编码格式

1、Web.Config设置

<configuration>

  <system.web>

    <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

  </system.web>

</configuration>

 

2、单个页面设置

<configuration>

  <location path="Index.aspx">
    <system.web>
      <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en"/>
    </system.web>

  </location>

</configuration>


<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>

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

Page_Load

Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");

你可能感兴趣的:(asp)