Page 1 of 1

[SOLVED] WebClient doesnt throw exception 400

Posted: Fri Nov 24, 2017 6:56 am
by sebas

Code: Select all

            try
            {
                WebClient wc = new WebClient();
                string str;

                var Url = "http://dev01.tnomer.ru:7000/private/api/dictionary/work/asd";
                wc.Encoding = Encoding.UTF8;
                wc.Headers.Set("Content-Type", "application/json");

               
                str = wc.DownloadString(Url );
                System.Windows.MessageBox.Show("ok" + str);
            }
            catch (Exception ex)
            {

                System.Windows.MessageBox.Show("error!!! " + ex.ToString());
            }





In emulator
---------------------------

---------------------------
error!!! System.Net.WebException: The remote server returned an error: (400) Bad Request.

at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)

at System.Net.WebClient.DownloadString(Uri address)

at System.Net.WebClient.DownloadString(String address)

at Application1.MainPage..ctor() in C:\Users\user\AppData\Local\Temporary Projects\Application1\MainPage.xaml.cs:line 28
---------------------------
ОК
---------------------------



in browser
ok{"id":["The value 'asd' is not valid."]}

Re: WebClient doesnt throw exception 400

Posted: Thu Nov 30, 2017 12:49 am
by JS-Support @Userware
Hi,

Thanks for reporting this issue.

It has been fixed in Beta 12.8 and above, which you can download from:
http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support