×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    1

    Windows Phone 8 HttpWebRequest.BeginGetResponse() issue

    Hello everyone

    I am developing an application for Android,Windows Store and Windows Phone . This Application is based on the Shared Code strategy . So using Dependency Injection Framework , I am implementing all the platform specific functions separately.

    I have to implement a function for fetching WebResponse by sending a HttpWebRequest consisting of some headers . In windows Store , i have done this using HttpClient and HttpRequestMessage and Response.

    But in Windows Phone I can do this using HttpwebRequest.BeginGetResponse() method only if this method is being called from a main thread and not Worker thread . But I have to call it from a Worker thread .

    Can you please tell me how i can do that ??? ...And yeah I am a newbie in App Development and have no experience in this ..So if you can be elaborative , It will be helpful

    Thank You

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    477

    Re: Windows Phone 8 HttpWebRequest.BeginGetResponse() issue

    If you're looking for a portable solution, I would recommend looking into HttpClient Portable available via NuGet...

    http://blogs.msdn.com/b/dotnet/archi...tm-200-ok.aspx

    Also, are you supporting WP7, WP8 or both?

    (there's also WebClient which is very easy to use)
    Last edited by theothernt; 2013-07-12 at 12:31.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    608

    Re: Windows Phone 8 HttpWebRequest.BeginGetResponse() issue

    I'm using HttpWebRequest(AsyncCallback, RequestState); from my own Thread and not the "main" thread and it works great
    what exactly is the problem ur facing with it?

  4. #4
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: Windows Phone 8 HttpWebRequest.BeginGetResponse() issue

    You can call it from the Main thread. Since BeginGetResponse method is asynchronous, it will not block the UI thread. Simply execute the Task on the main thread and then return to your worker thread.

Similar Threads

  1. Windows Phone 8 and Windows 8 input validations
    By josueyeray in forum Windows Phone General
    Replies: 3
    Last Post: 2013-06-17, 06:11
  2. Replies: 2
    Last Post: 2013-04-15, 12:10
  3. Windows phone 8 app installation on phone without putting it on windows store
    By KnowledgeSeeker in forum Windows Phone General
    Replies: 2
    Last Post: 2013-03-05, 12:12
  4. Replies: 1
    Last Post: 2013-02-14, 17:47
  5. Replies: 1
    Last Post: 2002-07-16, 06:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •