[C#] 纯文本查看 复制代码
string parameters = "a=123456&b=456789&c=456456";
//使用指定的编码对象对 URL 字符串进行编码。
string URLEncode = HttpHelper.URLEncode(parameters);
//使用指定的编码对象将 URL 编码的字符串转换为已解码的字符串。
string URLDecode = HttpHelper.URLDecode(URLEncode);
Response.Write(string.Format("<br/><br/>URLEncode={0}<br/>URLDecode={1}<br/>", URLEncode, URLDecode));
//使用指定的编码对象对 URL 字符串进行编码。
URLEncode = HttpHelper.URLEncode(parameters, System.Text.Encoding.UTF8);
//使用指定的编码对象将 URL 编码的字符串转换为已解码的字符串。
URLDecode = HttpHelper.URLDecode(URLEncode, System.Text.Encoding.UTF8);
Response.Write(string.Format("<br/><br/>URLEncode={0}<br/>URLDecode={1}<br/>", URLEncode, URLDecode));
[C#] 纯文本查看 复制代码
//创建Httphelper对象
HttpHelper http = new HttpHelper();
string url = "http://member1.taobao.com/member/user_profile.jhtml?user_id="+HttpHelper.URLEncode("欧影点点");
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL =url,//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
//获取请求的Cookie
string cookie = result.Cookie;