I suggest you ...

Add HttpClient support in Portable Class Libraries (including Windows Phone 8)

1,887 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    IgorIgor shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    63 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Patrick DenglerPatrick Dengler commented  ·   ·  Flag as inappropriate

        Hi folks!

        There is an issue with the Http PCL implementation (and I tried the beta as well) whereas form fields with brackets are rejected. I understand why, but it is a common pattern for SAAS sites. http://social.msdn.microsoft.com/Forums/windowsapps/en-US/d1040cc3-1f12-419b-b3db-81eb45dff5d3/multiformdatacontent-fails-on-pcl-for-systemnethttp-when-using-names-that-contain-brackets-eg?forum=winappswithcsharp

        Is there any chance this could be fixed?

      • AlvaroAlvaro commented  ·   ·  Flag as inappropriate

        Is there any way to track progress of the request using PCL WebRequest?

      • Ryan RileyRyan Riley commented  ·   ·  Flag as inappropriate

        Any chance the platform restriction could be lifted so the library could be used in cross-platform libraries such as the FSharp.Data type providers?

      • Immo Landwerth (MSFT)Immo Landwerth (MSFT) commented  ·   ·  Flag as inappropriate

        Gabriel, this inconsistency comes from the phone's underlying networking stack. On desktop this exception originates from the socket layer which has the context of SocketError.AbortedConnection. On phone we get a WebException, but handle it since the response exists with a status code. Unfortunately, the reponse doesn't have enough context to mimic the exception. The state returned in HttpWebResponse is the same for an aborted connection as it is for a non-existant server, among other errors. So while in theory we could throw try to throw an exception we would provide inconsistent behavior in other cases. So I'm afraid there is no way for us fix this without making other cases worse.

      • Gabriel S.Gabriel S. commented  ·   ·  Flag as inappropriate

        There is a problem and inconsistency when it comes to request failures. On Windows Phone 8, when a request fails to reach the server, the HttpResponseMessage can be successfully retrieved and has the IsSuccessstatusCode property set to false.

        On .Net 4.5 Full and Windows Store Apps types of projects, the behaviour is instead to throw an HttpRequestException - which to me seems the correct and natural way - when this line of code is executed:

        var response = await httpClient.PostAsync(uri, content);

        I'm not sure if it's due to the WP8 http implementation or due to the portable HttpClient, but it's a quite unpleasant inconsistency. Do you think it can be fixed?

      • Rick DeMaioRick DeMaio commented  ·   ·  Flag as inappropriate

        Having trouble with Win8 Phone. Always hangs on .Result. or the last async call. Standard .net 4.5 worked like a champ without the portable stuff. I tried 5 different patterns of ContinueWith, .Result, Send, Post, Get, Wait and everything hangs. the Task says waiting for activation. MSHTTP is 2.1.10, BCL Build is 1.07, BCL Port is 1.0.19

      • ChrisChris commented  ·   ·  Flag as inappropriate

        I don't understand? How do I know what version nuget is? It is fully patched up to date. And I see only one listing for this package in there which is Version: 2.1.20710.0

      • David KeanDavid Kean commented  ·   ·  Flag as inappropriate

        Chris, it sounds like you are installing the RTM 2.0 version instead of the 2.1 RC. Also make sure you have NuGet 2.1 installed.

      • ChrisChris commented  ·   ·  Flag as inappropriate

        I can't get this to install. It says Microsoft.Net.Http could not be installed because it is not compatible with any project in the solution. The package targets .NETFramework, Version 4.5, 4.0

        I had just created a new project for Windows Phone 8, using VS2012.. so what's the problem?

      • Dominic FerlandDominic Ferland commented  ·   ·  Flag as inappropriate

        It work great for me until i install the Visual Studio 2012 Update 2.

        I'm getting this compilation error when building my portable class library:

        The Type 'System.Net.HttpStatusCode' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

        I have done the test on 2 different computer... and after installing the update 2... the solutions dont compile anymore.

        Have you seen that before ?

        Dominic

      • Alexander GnauckAlexander Gnauck commented  ·   ·  Flag as inappropriate

        I need to connect to https sites which self signed certificates, or signed by a CA which is not trusted by Windows Phone by default. Is there solution using this library, or is this on the roadmap?
        or is this only a wrapper to HttpWebRequest which does not support this feature on Windows Phone?

      • David KeanDavid Kean commented  ·   ·  Flag as inappropriate

        Xavier: The project is still alive. By "barfed" what do you mean? Didn't install? If so, try upgrading your version of NuGet to the latest.

      • xavier rigauxavier rigau commented  ·   ·  Flag as inappropriate

        Is this project still alive? I tried to download it for a Windows Phone 8 solution and it barfed.

      • Tony TedeschiTony Tedeschi commented  ·   ·  Flag as inappropriate

        I was hoping that the full HttpClient would have been in the mix. I would love to consume JSON content from a Web API site. The full client supports PutAsJsonAsync<T>(...) which could enable a windows phone device to consume a web api with very minimal traffic.

        Is the full HttpClient being considered? It would be great to leverage the super light weight data flows from the JSON in the ew WebApi framework.

      • Michael LantMichael Lant commented  ·   ·  Flag as inappropriate

        Please make sure that it supports the .result capability to force the call to be synchronous. This is a very important construct that allows the entire call stack to be wrapped inside of a Task.run() call. It makes the whole async isssue drop-dead simple.

      • TrooperTrooper commented  ·   ·  Flag as inappropriate

        Thanks.. that's a fantastic news for any .NET developer!

        @Rui Marinho, follow the blog link and read it. It sates that WP7.5+ is supported. So YES they didn't forget about 7.5!

      ← Previous 1 3 4

      Feedback and Knowledge Base