locked
How to Make a Synchronous service Call using HttpWebRequest (or) HttpClient in C#/XAML Metro App? RRS feed

  • Question

  • I am Developing a C#/Xaml Metro Application in that As per the Requirement I want to have a Synchronous service call , instead of ASynchronous Service Call.

    This what I have used for Async Operation but I want to make a Synchronus Service Call :-

       
     HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://xxxxxxx");
        request.Method = "POST";
        request.Credentials = new NetworkCredential("xxx", "xxx");
         using (Stream requestStream = await request.GetRequestStreamAsync())
        {
        }
    

    Please Let me know:-

    1)how can I Make a Synchronous service Call using HttpWebRequest or HttpClient in C#/XAML Metro App ????

    2)how can i wait until that asynchornous call is compleleted (apart from using await ) ?? i want to wait completely and dont do any operation until the asynchronous call is completed. ??

    Looking forward for your response.

    Thanks in Advance.

    Wednesday, October 16, 2013 6:43 AM

Answers