.net解决乱码的旁门走道
来源:互联网 发布:p2p记账软件 编辑:程序博客网 时间:2024/04/28 21:25
有时候我们也许需要这样,在UFT-8的编码下提交GB2312数据给其它站处理。
那么有个最简单的办法如下:
在web.config中configuration标签下加入如下代码
(文件名需要在根目录哦。)
<location path="sendContent_manage.aspx">
<system.web>
<globalization fileEncoding="GB2312" requestEncoding="GB2312" responseEncoding="GB2312" culture="zh-CN"/>
</system.web>
</location>
在主页面中加入如下框架
<iframe src="/sendContent.html" id=pluginFra name=pluginFra frameborder=0 marginheight=0 marginwidth=0 width=0 height=0 style=display:none;></iframe>
<script>document.getElementById("pluginFra").src = "/sendContent_manage.aspx?to_userid=";</script>
sendContent.html内容如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>短信发送</title></head><body>no</body></html>
sendContent_manage.aspx内容如下:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %><% /** * *********************************************** * Author:prospertu * CreateDate:2015/11/14 11:18 * Note:在后台短信发送 * ************************************************ */ %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>send message</title></head><body><% Page.Request.ContentEncoding = Encoding.GetEncoding("GB2312"); Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Request.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.Charset = "936"; string mobileNum = "手机号"; to_content = "短信内容"; to_content = Server.UrlEncode(to_content); string url_sendInfo = "http://发短信?mobile=" + mobileNum + "&content=" + to_content;//tl=1 Response.Write("<script>location.href='" + url_sendInfo + "';</script>"); %></body></html>
0 0
- .net解决乱码的旁门走道
- 旁门解决IIS拒绝服务问题
- ASP.NET中文乱码问题的解决
- ASP.NET中各种乱码的解决
- 解决ASP.NET带中文参数出现乱码的问题
- [.NET]解决使用JMail接收邮件时的标题乱码
- ASP.NET 导出Excel乱码的终极解决
- 解决JAVA、.NET间WebService传递中文乱码的问题
- Asp.net 解决导出CSV文件乱码的问题
- asp.net 中文传值乱码问题的解决
- asp.net 下载文件的文件名乱码解决
- net传值乱码解决
- 解决.net连接mysql乱码
- 解决ASP.NET中文乱码
- ASP.NET 解决Cookie乱码
- 解决ASP.NET中文乱码
- 解决 FastReport. Net 中文乱码
- ASP.NET解决中文乱码
- 关于堆与栈的区别
- c++primer第十章习题(1)
- Java MD5加密算法的实现
- python 学习笔记3
- javaScript-引用类型(一)
- .net解决乱码的旁门走道
- 数据结构(Java)——栈的实现总结
- 10.UIImageView图片视图
- Android开发Vitamio开发框架Audio音频播放失败
- kvo
- 1009. Product of Polynomials (25)
- vijos P1051 送给圣诞夜的极光
- POJ 3764 The xor-longest Path (01字典树 + DFS)
- 二叉树的遍历和生成——Pascal实现