原文链接:http://www.cnblogs.com/mytechblog/articles/1937407.html
全站应用utf-8格式,在web.config里的<system.web></system.web>节点内插入globalization节点。如下:
<globalization requestEncoding=”utf-8″ responseEncoding=”utf-8″ fileEncoding=”utf-8″ />
某个页面要设置gb2312编码格式
方法是: 在webconfig文件configuration元素下配置以下字节,path 可以目录路径,也可以单独指向某个文件..
<location path=”Agent/index.aspx”>
<system.web>
<globalization fileEncoding=”gb2312″ requestEncoding=”gb2312″ responseEncoding=”gb2312″ culture=”zh-CN”/>
</system.web>
</location>
web.config如下
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--all-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" culture="en-US"/>
</system.web>
<location path="Agent/Index.aspx">
<system.web>
<!--one-->
<globalization requestEncoding="gb2312" responseEncoding="gb2312" fileEncoding="gb2312" culture="zh-CN"/>
</system.web>
</location>
</configuration>