HttpWebRequest 和 WebClient 中缺少功能吗?
您希望在 System.Net.HttpWebRequest 和 System.Net.WebClient< /a> 不包含开箱即用的吗?
通过这些课程不能或不容易实现什么?
我希望能够:
- 下载时使用带宽限制(对于大文件有用)。
- 通过 HTTP post 上传多个文件和键值对(使用 WebClient 可以轻松上传单个文件和单个键值对集合)。
What features do you want to see in System.Net.HttpWebRequest and System.Net.WebClient that are not included out of the box?
What cannot or cannot be easily achieved with those classes?
I'd like to be able to:
- Use bandwidth throttling when downloading (useful for large files).
- Upload multiple files and key-value pairs via HTTP post (A single file and a single collection of key-value pairs is easy using WebClient).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我希望看到这两个类都更新为允许通过
Task
和Task
进行异步操作。一些示例 -
在 WebClient 中,我希望看到类似的方法 -
在 HttpWebRequest 中,我希望看到:
当然,第二个可以使用
TaskFactory.FromAsync
使用,但这并不那么简单是。I would like to see both of these classes updated to allow asynchronous operation via
Task
andTask<T>
.Some examples -
In WebClient, I would like to see methods like -
In HttpWebRequest, I'd like to see:
Granted, the second is usable using
TaskFactory.FromAsync
, but that's not as simple as it could be.我希望 .NET 有一个使用 WinINet 子系统。(或者假装得非常非常好。)
在许多情况下,我“退回”到 MSXML/XMLHTTPRequest 只是因为连接“像 IE 一样工作”——如果用户可以在 IE 中访问它,然后可以通过 MSXML 访问它。对于没有手动配置的 .NET 连接器,以下情况并不总是正确。呃。
我的经验来自.NET35,我不确定.NET4 发生了什么变化。
I wish that .NET had a HTTP connector that used the WinINet subsystem. (Or faked it really, really well.)
In a number of cases I "fall back" to MSXML/XMLHTTPRequest simply because the connections "work like IE" -- if the user can access it in IE, then they can access it via MSXML. The following is not always true about the .NET connector without a manual configuration. Uhg.
My experience comes from .NET35 and I am not sure what .NET4 changes.
将 html 页面 + css + 图像下载到单个 MHT 文件。
我希望能够下载包含所有 CSS、图像和脚本的网页,并将其保存到单个 MHT 文件中。然后我将它用作 MailMessage 的 HTML 正文。
Download html page + css + images to a single MHT file.
I'd like to be able to download the web page with all CSS, images and scripts and save it to a single MHT file. Then I would use it as HTML body of MailMessage.