.net encode encode 怎么能让编码的部分是大写 没编码的不变如 : http://www.baidu.com?id=编号&url=http://www.sina.com http://www.baidu.com?id=%E7%BC%96%e5%8F%Bb7url=http%3A%2F%2Fwww.sina.com 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 还真想看看怎么变换!除非你encode后再把他转换成大写吧。 试一下去,对了要给分哦 private string UrlEncode(string value) { StringBuilder result = new StringBuilder(); foreach (char symbol in value) { if (unreservedChars.IndexOf(symbol) != -1) { result.Append(symbol); } else { result.Append('%' + String.Format("{0:X2}", (int)symbol)); } } return result.ToString(); } 对了,加个声明string unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~"; Response.Redirect("test1.aspx?111="+System.Web.HttpUtility.UrlEncode("中华人明共和国")) ; //建议使用最后如果是从其他的页面获取中文参数没有乱码,那就更简单了 string message ="http://localhost/Test/test1.aspx?111="+System.Web.HttpUtility.UrlEncode("中华人明共和国"); http: //你要获取某个页面的返回值的地址" //发送请求 HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(message) ; //接受请求 HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse() ; Stream receiveStream = myHttpWebResponse.GetResponseStream() ; StreamReader readStream = new StreamReader(receiveStream, System.Text.Encoding.GetEncoding("GB2312")) ; //此为要取页面的返回值输出的返回结果 returnValue = readStream.ReadToEnd(); 谁能帮忙解释下关于。net的一些问题 .NET软件架构之美有中文版吗 高手请进,困扰很久的问题。 asp.net 求教 在线等!!!谢谢 请教用GridView编写分页程序 高手指点下面错误是为什么??? 如何实现站内搜索功能 ????????这段ado怎么改成ado.net ?????? datagrid如何根据数据表中的值显示数据 该错,谢谢大哥们了,小弟刚刚上班,很多不会, 两个时间段,获取重复的部分。 急急,怎样将“对象”(类)发布出去
private string UrlEncode(string value) {
StringBuilder result = new StringBuilder(); foreach (char symbol in value) {
if (unreservedChars.IndexOf(symbol) != -1) {
result.Append(symbol);
} else {
result.Append('%' + String.Format("{0:X2}", (int)symbol));
}
} return result.ToString();
}
对了,加个声明
string unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
//建议使用最后如果是从其他的页面获取中文参数没有乱码,那就更简单了
string message ="http://localhost/Test/test1.aspx?111="+System.Web.HttpUtility.UrlEncode("中华人明共和国");
http:
//你要获取某个页面的返回值的地址"
//发送请求
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(message) ;
//接受请求
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse() ;
Stream receiveStream = myHttpWebResponse.GetResponseStream() ;
StreamReader readStream = new StreamReader(receiveStream, System.Text.Encoding.GetEncoding("GB2312")) ;
//此为要取页面的返回值输出的返回结果
returnValue = readStream.ReadToEnd();