Webclient only works in the simulator?

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
zemorango
Posts: 36
Joined: Tue Feb 02, 2016 6:30 am

Webclient only works in the simulator?

Postby zemorango » Sat Nov 19, 2016 10:58 am

I Have this code that runs just fine in the simulator :D I get the data that I want back , but when running in the browser nothing happens :o , I'm using version 10.3 Beta, I'm I missing something?

Code: Select all

           var webClient = new System.Net.WebClient();

          webClient.Headers[HttpRequestHeader.Accept] = "text/xml";

            webClient.Encoding = Encoding.UTF8;
         
            string response= webClient.UploadString("http://bytemotionappV2.cloudapp.net:807/Mobile/Hospitality/WP/producao/loginXamarinGet.php?username=1&password=2","");


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

Re: Webclient only works in the simulator?

Postby JS-Support @Userware » Sat Nov 19, 2016 2:01 pm

Hi,

Can you please check if you see any warning or error in the browser console log? (in Chrome for example, press F12 then click "Console")

Thanks.
Regards,
JS-Support

zemorango
Posts: 36
Joined: Tue Feb 02, 2016 6:30 am

Re: Webclient only works in the simulator?

Postby zemorango » Sun Nov 20, 2016 3:57 am

Hi, Js-Suport, i've done just like you said , this is the result in the log when i hit the login button, I send you an attachment image.

I did run the app using Wamp server, don't know is I need to make some kind of config . :shock:

Regards

zemorango
Attachments
error.jpg
error.jpg (173.19 KiB) Viewed 4602 times

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

Re: Webclient only works in the simulator?

Postby JS-Support @Userware » Mon Nov 21, 2016 5:09 am

Hi zemorango,

The issue is related to a cross-domain call.

You can read how to implement CORS for cross-domain calls at the following URL:
http://cshtml5.com/links/wcf-limitations-and-tutorials.aspx#cors

Thanks.
Regards,
JS-Support

zemorango
Posts: 36
Joined: Tue Feb 02, 2016 6:30 am

Re: Webclient only works in the simulator?

Postby zemorango » Mon Nov 21, 2016 5:26 pm

Hi JS-Suport

The problem is solved, you are right, ;) it was a cross domain problem, all is working now :D

Thank you very mush to pointing me in the right direction.

Regards

zemorango


Return to “Technical Support”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests