使用C#WinForms编码自定义安装程序时,我偶然发现以下错误:“应用程序中发生未处理的异常。如果单击“继续”,则应用程序将忽略此错误并尝试继续。如果单击“退出”,则应用程序将立即关闭。
尝试了太多的自动重定向。 “
它伴随以下错误文本:
************** Exception Text **************
System.Net.WebException: Too many automatic redirections were attempted.
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at Security__Installer.frmInstaller.Install()
at Security__Installer.frmInstaller.btnNext_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
我正在尝试为我为GTA V构建的mod进行安装,然后单击按钮,运行代码以下载.rar文件和.zip文件(我的其他mod是取决于),如果我拥有zip和rar,我拥有解压缩/解压缩,安装它们和我的mod等所需的全部代码。但是我不想窃取其他mod作者的mod,我想直接从中下载他们,以便他们获得下载计数。我在这里想念东西吗?
我尝试转到提供的链接,并且在那儿都很好,甚至都没有重定向,这使我感到困惑。
我的一些代码:
webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, "security=true");
webClient.DownloadFile("https://www.lcpdfr.com/files/file/22536-gruppe-sechs-corporate-security-agency/?do=download&csrfKey=a2526f8cfe74c1d9c23cc78f839d891c", dir + "\\temp\\GruppeSechs.rar");
我希望rar会出现,并且我将能够解压缩rar,但是很不幸,它只是等待了一段时间,显示了错误,无论我单击它都会崩溃。