How can we improve the Windows dev platform?

Allow CookieContainer to be Serialized/Deserialized

Currently, serialization and deserialization of the CookieContainer doesn't work. The documentation says to use the CookieContainer if one needs to save off HttpOnly cookies. It seems that saving the CookieContainer isn't possible.

"If the server sends HTTPOnly cookies, you should create a System.Net.CookieContainer on the request to hold the cookies, although you will not see or be able to access the cookies that are stored in the container."

133 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    DerekDerek shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    RyanRyan shared a merged idea: Allow access to HttpOnly cookies when using HttpWebRequest/Response  ·   · 
    Sorry, no plans!  ·  Clint RutkasAdminClint Rutkas (Admin, Windows Developer) responded  · 

    Adding serialization to CookieContainer is unlikely to happen for the .NET Framework CookieContainer class. In general, binary serialization for .NET objects is something that is being deprecated over time. In fact, the new .NET Core (CoreFx/CoreCLR) does not support any binary serialization at all.

    https://www.infoq.com/news/2016/02/Core-Discontinued

    Serialization
    Most of the serializer such as data contract serialization, XML serialization, JSON.NET, and protobuf-net will be supported in .NET Core. The major exception is binary serialization.

    After a decade of servicing, we’ve learned that serialization is incredibly complicated and a huge compatibility burden for the types supporting it. Thus, we made the decision that serialization should be a protocol implemented on top of the available public APIs. However, binary serialization requires intimate knowledge of the types because it allows to serialize object graphs, which includes private state.

    7 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base