Page 1 of 1

WebClient

Posted: Mon Nov 02, 2015 11:14 pm
by CyborgDE
Hello,

you make me crazy :-)

Code: Select all

                var webClient = new WebClient();
                webClient.Headers[HttpRequestHeader.Accept] = "text/xml";
                webClient.Encoding = Encoding.UTF8;
                webClient.DownloadStringCompleted += Load_DownloadStringCompleted;
                webClient.DownloadStringAsync(new Uri("http://" + IP + "/app/nothing.xml"));

Code: Select all

        void Load_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
                WebClient webClient = sender as WebClient;
                if (webClient == null)
                {
                    throw new ArgumentException("No WebClient !");
                }
         }

Under JavaScript I got the Exception !!!

Regards, Uwe

Re: WebClient

Posted: Tue Nov 03, 2015 12:36 am
by CyborgDE
If the server ist unavailable, in got no Load_DownloadStringCompleted event under JavaScript ...

Re: WebClient

Posted: Tue Nov 03, 2015 4:02 am
by CyborgDE
Also no exception in DownloadStringTaskAsync ...