Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Why my HttWebRequest getResponseAsync does not end

$
0
0

Hey monkeys,

I have a problem.

I'm trying to get a response of a request to an Sharepoint Rest Api.

On a Console Application, my code run as well but on Xamarin.Forms it does not end GetResponseAsync().

My code:

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("MyUri");
            request.Method = "GET";
            request.Accept = "application/json;odata=verbose";
            request.Credentials = new NetworkCredential(user, pass, domain);
            string ResultStream = "";
            try
            {
                using (WebResponse response = await request.GetResponseAsync())
                {
                    using (Stream responseStream = response.GetResponseStream())
                    {
                        using (StreamReader reader = new StreamReader(responseStream))
                        {
                            ResultStream = reader.ReadToEnd();

                            var obj = Newtonsoft.Json.Linq.JObject.Parse(ResultStream);
                            var x = obj["results"];
                            x = x;
                        }
                    }
                }
            }
            catch (Exception e)
            {

                throw;
            }

Can anyone help me?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>