不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
[ASP]CodePage、Response.CodePage和Session.CodePage三者的区别
编辑:dnawo 日期:2015-01-17
关于CodePage、Response.CodePage和Session.CodePage三者的区别,MSDN说明如下:
引用内容
大意是CodePage影响静态文本,Response.CodePage影响动态文本,Session.CodePage的作用和Response.CodePage相同,只是它的作用范围更大,影响同一会话的所有响应。
1、CodePage和Response.CodePage的测试



说明:网页文件编码为UTF-8。
2、Response.CodePage和Session.CodePage的测试


3、CodePage、Response.CodePage和Session.CodePage取值顺序
若未设置CodePage:
引用内容
若未设置Response.CodePage:
引用内容
若未设置Session.CodePage:
引用内容
4、Response.Charset的作用
还是看MSDN的说明:
引用内容
5、参考资料
[1].@CODEPAGE:http://msdn.microsoft.com/en-us/library/ms524967.aspx
[2].Response.CodePage:http://msdn.microsoft.com/zh-cn/library/aa711540
[3].Session.CodePage:http://msdn.microsoft.com/zh-cn/library/ms525649

Setting @CODEPAGE explicitly affects literal strings in a single response. Response.CodePage affects dynamic strings in a single response, and Session.CodePage affects dynamic strings in all responses in a session.
大意是CodePage影响静态文本,Response.CodePage影响动态文本,Session.CodePage的作用和Response.CodePage相同,只是它的作用范围更大,影响同一会话的所有响应。
1、CodePage和Response.CodePage的测试
复制内容到剪贴板
程序代码

<%@ CodePage=65001 %>
<%
Response.Charset="utf-8"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。
<%
Response.Charset="utf-8"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。

复制内容到剪贴板
程序代码

<%@ CodePage=65001 %>
<%
Response.Charset="gb2312"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。
<%
Response.Charset="gb2312"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。

复制内容到剪贴板
程序代码

<%@ CodePage=936 %>
<%
Response.Charset="gb2312"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。
<%
Response.Charset="gb2312"
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。

说明:网页文件编码为UTF-8。
2、Response.CodePage和Session.CodePage的测试
复制内容到剪贴板
程序代码

<%
Response.Charset="gb2312"
Session.CodePage = 65001
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。
Response.Charset="gb2312"
Session.CodePage = 65001
Response.CodePage = 936
Response.Write("这是动态文本。")
%>
这是静态文本。

复制内容到剪贴板
程序代码

<%
Response.Charset="gb2312"
Response.CodePage = 936
Session.CodePage = 65001
Response.Write("这是动态文本。")
%>
这是静态文本。
Response.Charset="gb2312"
Response.CodePage = 936
Session.CodePage = 65001
Response.Write("这是动态文本。")
%>
这是静态文本。

3、CodePage、Response.CodePage和Session.CodePage取值顺序
若未设置CodePage:

If @CODEPAGE is not explicitly set in a page, it is implicitly set by the AspCodePage metabase property or by the system ANSI code page.
若未设置Response.CodePage:

If Response.CodePage is not explicitly set in a page, it is implicitly set by Session.CodePage, if sessions are enabled. If sessions are not enabled, Response.CodePage is set by @CodePage, if @CodePage is present in the page. If there is no @CodePage in the page, Response.CodePage is set by the AspCodePage metabase property. If the AspCodePage metabase property is not set, or set to 0, Response.CodePage is set by the system ANSI codepage.
若未设置Session.CodePage:

If Session.CodePage is not explicitly set on a page, it is implicitly set by the AspCodePage metabase property. If the AspCodePage property is not set, or set to 0, Session.CodePage is set by the system ANSI code page. Session.CodePage is no longer implicitly set by @CodePage, as it was for IIS 5.0 and earlier versions. This change was made because one @CodePage could change the code page for an entire session. Now, @CodePage and Response.CodePage affect only single responses, while Session.CodePage affects all responses in a session.
4、Response.Charset的作用
还是看MSDN的说明:

If the code page is set in a page, then Response.Charset should also be set. The code page value specifies to IIS how to encode the data when building the response, and the charset value tells the browser how to decode the data when displaying the response. The CharsetName of Response.Charset must match the code page value, or mixed characters are displayed in the browser.
5、参考资料
[1].@CODEPAGE:http://msdn.microsoft.com/en-us/library/ms524967.aspx
[2].Response.CodePage:http://msdn.microsoft.com/zh-cn/library/aa711540
[3].Session.CodePage:http://msdn.microsoft.com/zh-cn/library/ms525649






评论: 0 | 引用: 0 | 查看次数: 5210
发表评论
请登录后再发表评论!