我正在尝试让 HttpRequest 发布此 URL
https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[电子邮件受保护]&PASSWORD=什么!什么!
我尝试过使用
WebClient rar = new WebClient();
rar.OpenReadAsync(new Uri(@"https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[email protected]&PASSWORD=What!What!"));
rar.DownloadStringAsync(new Uri(@"https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[email protected]&PASSWORD=What!What!"));
This is Should 删除我在他们网站上的信息,但没有成功。我正在关注这个文档。
http://getsatisfaction.com/exzact/topics/how_can_we_delete_old_records_not_manually
他们说我所要做的就是要做的就是将正确的 URL 粘贴到网络浏览器中,然后按 Enter 键,它就会 工作。我将如何在 C# 中做到这一点?任何帮助都会很棒!谢谢!
I'm trying to get an HttpRequest to post this URL
https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[email protected]&PASSWORD=What!What!
I've tried using
WebClient rar = new WebClient();
rar.OpenReadAsync(new Uri(@"https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[email protected]&PASSWORD=What!What!"));
rar.DownloadStringAsync(new Uri(@"https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&[email protected]&PASSWORD=What!What!"));
This is suppose to delete my information on their site, but it's not taking. i'm following this documentation.
http://getsatisfaction.com/exzact/topics/how_can_we_delete_old_records_not_manually
and they state that all I have to do is paste the proper URL into a web browser and hit enter and it will work. How would I do this equivalent in c#? Any help would be awesome! Thanks!
发布评论
评论(5)
使用 WebClient.DownloadString 而不是 DownloadStringAsync。 Async表示不阻塞当前线程的异步方法。
Use WebClient.DownloadString instead of DownloadStringAsync. Async indicates asynchronous methods that do not block the current thread.
在提交之前,尝试在 WebClient 中设置 User-Agent 标头,看看是否可以解决问题。
rar.Headers.Add("user-agent", "Mozilla/4.0 (兼容; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
设置了很多Web服务器如果 User-Agent 标头丢失,则最多可以忽略请求。
随后,您在此处使用 HTTPS,因此您还需要设置
ServicePointManager.ServerCertificateValidationCallback
。Try setting your User-Agent header in your WebClient before you submit it to see if that fixes things.
rar.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
A lot of web servers are set up to simply ignore requests if the User-Agent header is missing.
Subsequently, you're using HTTPS here so you'll want to set up your
ServicePointManager.ServerCertificateValidationCallback
as well.尝试使用 System.Web 类,例如像这样:
这是 post 方法的示例,您可以使用任何其他像这样的 HTTP 方法。查看文档。
Try to use System.Web classes, for example like this:
It's example for post method, you can use any other HTTP method like this. Check the documentation.
这不是您问题的直接答案,但请查看Hammock for REST
This isn't a direct answer to your question but check out Hammock for REST