Ich habe eine Datei, die sich auf http://10.1.10.211:8600/CardsPro+.exeabrufen Datei von IIS Server mit Sonderzeichen im Namen C#
Und ich versuche es mit dem folgenden Code zum Abrufen aber den Fehler "HTTP-Fehler erhalten 404.11 - Not Found "
private WebClient webClient;
private BackgroundWorker bgWorker;
private string tempFile;
private string md5;
internal string TempFilePath
{
get { return this.tempFile; }
}
internal UpdateInfoDownloadForm(Uri location, string md5, Icon programIcon)
{
InitializeComponent();
if (programIcon != null)
{
this.Icon = programIcon;
}
tempFile = Path.GetTempFileName();
this.md5 = md5;
webClient = new WebClient();
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted);
bgWorker = new BackgroundWorker();
bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork);
bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BgWorker_RunWorkerCompleted);
try
{
string strend = location.ToString().Substring(location.ToString().LastIndexOf('/')+1);
string strstart = location.ToString().Substring(0,location.ToString().LastIndexOf('/')+1);
strend = System.Web.HttpUtility.UrlEncode(strend);
Uri locn = new Uri(strstart+strend);
webClient.DownloadFileAsync(locn, this.tempFile); **//It fails here**
}
catch(Exception ex)
{ this.DialogResult = DialogResult.No; this.Close(); }
}
Wie kann ich pass die Uri die Datei zu erhalten, die den besonderen Charakter in seinem Namen hat?
Es funktionierte, als ich die Dateinamen geändert.