c# - C# - 无法打开下载的 RAR 或 ZIP 文件
问题描述
需要你的帮助。当我下载自己打开但当我使用 c# windows 下载它时下载成功但未打开,我正在使用此代码下载 Rar 或 Zip 文件。
private void downloadBtn_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
string tAddress = "Download Link"; // When i Downloaded mySelf it Worked And Opened
string fileName = "Testfile.Zip";
Uri uri = new Uri(tAddress);
client.DownloadFileCompleted += Client_DownloadFileCompleted;
client.DownloadFileAsync(uri, fileName);
}
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download Completed Successfully!");
}
这是我尝试打开 Rar 或 Zip 文件时的错误。 它说错误,此文件格式不正确或已损坏,但是当我尝试自己下载时,它已打开
解决方案
推荐阅读
- android - Android - 获取当前在另一个应用程序中播放的视频的标题/位置/持续时间
- macos - MacOS Sur 从任何地方下载
- php - MYSQL PHP:根据地址列查找重复项
- sql - 如何将大约 5+ 百万个 id 发送到 SQL Server 存储过程以获得相应大小的总和?SQL 2012
- javascript - 按数字长度排序,然后按数字本身
- android - 华为 Map Kit onCameraIdle 方法未触发
- c++ - 配置 VS Code 代码运行器扩展以显示 CPP 警告
- java - 我的 AdMob 广告无法加载,无论是我的个人广告单元还是测试广告单元。广告加载失败 0
- inno-setup - Inno 编译器设置的 PermissionError
- reactjs - 如何在反应中使用子组件方法?