Page 1 of 1

Webclient only works in the simulator?

Posted: Sat Nov 19, 2016 10:58 am
by zemorango
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","");


Re: Webclient only works in the simulator?

Posted: Sat Nov 19, 2016 2:01 pm
by JS-Support @Userware
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

Re: Webclient only works in the simulator?

Posted: Sun Nov 20, 2016 3:57 am
by zemorango
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

Re: Webclient only works in the simulator?

Posted: Mon Nov 21, 2016 5:09 am
by JS-Support @Userware
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

Re: Webclient only works in the simulator?

Posted: Mon Nov 21, 2016 5:26 pm
by zemorango
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