Pause/Resume Upload in C#(在 C# 中暂停/恢复上传)
问题描述
我正在寻找一种通过 C# 的 WebClient 暂停或恢复上传过程的方法.
I'm looking for a way to pause or resume an upload process via C#'s WebClient.
伪代码:
WebClient Client = new WebClient();
Client.UploadFileAsync(new Uri("http://mysite.com/receiver.php"), "POST", "C:MyFile.jpg");
也许像..
Client.Pause();
有什么想法吗?
推荐答案
WebClient
没有这种功能 - 即使是稍微低级的 HttpWebRequest
也没有不,据我所知.您将需要使用一个 HTTP 库,它可以让您在事情发生时更好地控制确切(当然,这也将涉及更多代码).WebClient
的重点是提供一个非常简单的 API 以在非常简单的情况下使用.
WebClient
doesn't have this kind of functionality - even the slightly-lower-level HttpWebRequest
doesn't, as far as I'm aware. You'll need to use an HTTP library which gives you more control over exactly when things happen (which will no doubt involve more code as well, of course). The point of WebClient
is to provide a very simple API to use in very simple situations.
这篇关于在 C# 中暂停/恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 C# 中暂停/恢复上传


- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 输入按键事件处理程序 2022-01-01