方法一、设置web.config文件并改网页meta编码。
<system.web>
    <globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" uiCulture="zh-CN" responseHeaderEncoding="gb2312" fileEncoding="gb2312" />
</system.web>

并将所有.aspx文件头里编码写为:
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />

方法二、传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。
>> 传递前编码
Response.Redirect("B.aspx?Name="+Server.UrlEncode("中文参数"));

>> 接收时解码
Response.Write(Server.UrlDecode(Request["Name"]));

方法三、如果是使用javascript跳转到另一页,得使用escape将要传递的中文参数进行编码,在接收时再进行解码。
>> 传递前编码
<script language="JavaScript">
function GoUrl()
{
var Name = "中文参数";
location.href = "B.aspx?Name="+escape(Name) ;
}
<body onclick="GoUrl()">

>> 接收时解码
Response.Write(Server.UrlDecode(Request["Name"])) ;

相关文章:

  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2021-09-27
  • 2021-09-11
  • 2022-12-23
相关资源
相似解决方案