社区
C#
帖子详情
【老大帮忙】HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(strUrl);
zagj11
2009-04-25 01:02:42
strUrl 里面内容里面有中文怎么办?
http://blog.sina.com.cn/xixi哈哈雅茜/creat/blog/ 这个就报错《无效的 URI: 无法确定 URI 的格式。》
http://blog.sina.com.cn/xixi/creat/blog/ 这个就可以正常通过。
...全文
241
4
打赏
收藏
【老大帮忙】HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(strUrl);
strUrl 里面内容里面有中文怎么办? http://blog.sina.com.cn/xixi哈哈雅茜/creat/blog/ 这个就报错《无效的 URI: 无法确定 URI 的格式。》 http://blog.sina.com.cn/xixi/creat/blog/ 这个就可以正常通过。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zagj11
2009-04-25
打赏
举报
回复
Encoding myEncoding = Encoding.GetEncoding("gb2312");
zagj11
2009-04-25
打赏
举报
回复
自己解决聊。 谢谢
string PostUrl = HttpUtility.UrlEncode(textBox1.Text.Trim(), myEncoding);
sequals = HttpUtility.UrlEncode(":", myEncoding);
PostUrl = PostUrl.Replace(sequals, ":");
sequals1 = HttpUtility.UrlEncode("/", myEncoding);
PostUrl = PostUrl.Replace(sequals1, "/");
string Referer = HttpUtility.UrlEncode(textBox2.Text.Trim());
wuyq11
2009-04-25
打赏
举报
回复
HttpUtility.UrlEncode编码
Encoding ed=Encoding.GetEncoding("gb2312");
WebRequest req = WebRequest.Create("http://xxx/search.aspx?city=" + HttpUtility.UrlEncode("北京", ed));
WebResponse response = req.GetResponse();
yangqidong
2009-04-25
打赏
举报
回复
strUrl=HttpUtility.UrlEncode(strUrl);
c#编写http请求
public static
str
ing GetModel(
str
ing
str
Url
) {
str
ing
str
Ret = null;...
Http
WebRequest
request = (
Http
WebRequest
)
WebRequest
.
Create
(
str
Url
); request.Timeout = 2000; HttpWebResponse respon...
后台Post/Get 请求接口 方式
Post请求 1 public
str
ing HttpPost(
str
ing
Url
,
str
ing postData
Str
) 2 { 3 try 4 { 5
Http
WebRequest
request = (
Http
WebRequest
)
WebRequest
.
Create
(
Url
); 6 ...
C# 后台GET、POST 传值
public
str
ing GetModel(
str
ing
str
Url
) {
str
ing
str
Ret = null; try {
Http
WebRequest
request = (
Http
WebRequest
)
WebRequest
.
Create
(
str
Url
); request.Timeout = 2000;
提取页面HTML代码
方法一:采用 WebClient ,代码如下using System...{
str
ing
str
url
="网址"; WebClient aWebClient = new WebClient(); aWebClient.Encoding = System.Text.Encoding.UTF8;
str
ing htmlcode = aWebClient.Download...
爬虫
方法一:采用 WebClient ,代码如下 using System.Net;...
str
ing
str
url
="网址"; WebClient aWebClient = new WebClient(); aWebClient.Encoding = System.Text.Encoding.UTF8;
str
ing htmlcode = ...
C#
111,126
社区成员
642,541
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章