ASPNET 页面编码

转自:http://www.cnblogs.com/libingql/archive/2009/04/11/1433771.html

设置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");

posted on 2016-11-01 16:47  记性特差  阅读(207)  评论(0编辑  收藏  举报