Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Warum bekomme ich hier keine Exception wenn die Datei auf die die URI Source verweist nicht existiert?


WebClient wc = new WebClient();
try
{
wc.DownloadFileAsync(Source, C_Ziel.Text);
}
catch (System.Net.WebException we)
{
MessageBox.Show(we.Message, "Downloadmanager");
}
catch (System.InvalidOperationException ioe)
{
MessageBox.Show(ioe.Message, "Downloadmanager");
}
[/PHP]

Hi Pirat ;)

versuchs einfach mit Exception dann springt er auch bei nich existierender datei in den Catch block und vor allem auch bei einer URI die der Webclient nciht auflösen kann. Denn der Webclient hat mit macnhen URIS probleme.

hm komisch ich habe meinen Webtracker damals mit dieser methode gebaut und bei nicht existierenden dateien ist er in die exception rein gegangen

public bool getFile()

		{

			if (!this.sLocalPath.Equals(""))

			{

				try 

				{

					WebClient Client =  new WebClient();

					Client.DownloadFile(this.sURL,this.sLocalPath);	

					this.isLocal = true;

					return true;

				}

				catch (Exception)

				{

					//MessageBox.Show("Fehler beim laden von: "+this.sURL);

					return false;

				}

			}

			return false;

		}

Was du ncoh versuchen kannst ist mit der Webbrowserkomponente die URL aufzurufen und zu sehen ob ne fehlerseite kommt.

Was hast du den genau vor?

ups sorry hatte das async übersehen :) aber du könntest doch einfach eine überprüfung machen ob dir die Async Methode ein brauchbares ergebniss zrück gibt.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.