[SOLVED] WebClient doesnt throw exception 400

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
sebas
Posts: 21
Joined: Fri Oct 27, 2017 7:03 am

[SOLVED] WebClient doesnt throw exception 400

Postby sebas » Fri Nov 24, 2017 6:56 am

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."]}

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: WebClient doesnt throw exception 400

Postby JS-Support @Userware » Thu Nov 30, 2017 12:49 am

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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 31 guests

 

 

cron