-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flurl CookieJar backup and restore #758
Comments
You could serialize the data manually however you choose and re-hydrate a |
return Cookie.Count == 0 ? string.Empty : string.Join("; ", Cookie.Select(cookie => $"{cookie.Name}={cookie.Value}")); |
Good news! // string-based usage pattern
var saved = jar.ToString();
var jar2 = CookieJar.LoadFromString(saved);
// TextWriter-based usage pattern (i.e. save to a file)
using var writer = new StreamWriter("path/to/file");
jar.WriteTo(writer);
using var reader = new StreamReader("path/to/file");
var jar2 = CookieJar.LoadFrom(reader); For both usage patterns, the text-based representation is simple and human-readable. It contains 3 lines for each cookie, representing the 3 pieces of information needed to fully hydrate a
BREAKING: A few public utility methods on |
@tmenier Thanks for adding the new persistence methods. This is much better than before. I wonder if it's possible to make use of it with the What about making the |
@pinkplus Thanks for pointing this out, I think I overlooked CookieSession when I did this enhancement. Could you open a new issue though? I 'd like to track it separately in case it doesn't make it out in the initial 4.0 release. Thanks. |
Sure, created #775. |
Please describe the feature/enhancement in as much detail as possible.
Hello Tmenier and Everyone,
Is there any way or method that support me to export (backup) and import (restore) CookieJar for later use?
Thanks,
The text was updated successfully, but these errors were encountered: