But how could you live and have no story to tell!
访问统计 original graphics

一般存在这样两个解决方案:
1. 在web.config里面增加
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN"/>
2. 在后台代码里面对乱码进行decoder操作

上面两种都不是好的方案,第一个可能会导致其他的页面出现问题, 第二个虽然存到数据库中的是正确的,但是,用户看到的仍然是乱码,严重影响用户体验。那么,最好的解决方法在哪里?

解决思路:我们可以通过对web.config文件增加 <location> 配置节来对特定文件或者目录进行encoding配置 ,如下:
<location path="此处为目录或文件名">
    <system.web>
      <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN"/>
    </system.web>
</location>
posted on 2009-02-27 16:12  nextsoft  阅读(189)  评论(0编辑  收藏  举报