web.config sets the encoding format for an individual page

Original link: http://www.cnblogs.com/mytechblog/articles/1937407.html

The entire station uses utf-8 format, and inserts the globalization node into the <system.web></system.web> node in web.config. as follows:

<globalization requestEncoding=”utf-8″ responseEncoding=”utf-8″ fileEncoding=”utf-8″ />


  A page needs to set the gb2312 encoding format
  The method is: configure the following bytes under the configuration element of the webconfig file, path can be a directory path, or it can point to a file alone..
<location path=”Agent/index.aspx”>
<system.web>
<globalization fileEncoding=”gb2312″ requestEncoding=”gb2312″ responseEncoding=”gb2312″ culture=”zh-CN”/>
</system.web>
</location>


web.config is as follows

<?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>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326931573&siteId=291194637