iPhone: NSHTTPCookie is not saved across app restarts

You can save the cookie by saving its properties dictionary and then restoring as a new cookiebefore you go to re-connect. Save: NSArray* allCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:URL]]; for (NSHTTPCookie *cookie in allCookies) { if ([cookie.name isEqualToString:MY_COOKIE]) { NSMutableDictionary* cookieDictionary = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey:PREF_KEY]]; [cookieDictionary setValue:cookie.properties forKey:URL]; [[NSUserDefaults standardUserDefaults] setObject:cookieDictionary forKey:PREF_KEY]; } } … Read more

Sharing ASP.NET cookies across sub-domains

Set the property of Domain to .mydomain.example in each Cookies of two subdomains websites. Like: Response.Cookies[“test”].Value = “some value”; Response.Cookies[“test”].Domain = “.mysite.example”; In Site A: HttpCookie hc = new HttpCookie(“strName”, “value”); hc.Domain = “.mydomain.example”; // must start with “.” hc.Expires = DateTime.Now.AddMonths(3); HttpContext.Current.Response.Cookies.Add(hc); In Site B: HttpContext.Current.Request.Cookies[“strName”].Value

How to add a cookie to the cookiejar in python requests library

Quick Answer Option 1 import requests s = requests.session() s.cookies.set(“COOKIE_NAME”, “the cookie works”, domain=”example.com”) Option 2 import requests s = requests.session() # Note that domain keyword parameter is the only optional parameter here cookie_obj = requests.cookies.create_cookie(domain=”example.com”,name=”COOKIE_NAME”,value=”the cookie works”) s.cookies.set_cookie(cookie_obj) Detailed Answer I do not know if this technique was valid when the original question was … Read more

HTTP Cookies and Ajax requests over HTTPS

Ok, found the solution to the cookie problem. See XHR specs, jQuery docs and StackOverflow. The solution to have the cookies sent when switching protocol and/or subdomain is to set the withCredentials property to true. E.g. (using jQuery) $.ajax( { /* Setup the call */ xhrFields: { withCredentials: true } });

What is a host only cookie?

First of all, it is not possible for foo.com to set a cookie that can be read by bar.com. Host-only only protects example.com cookies from being read by bar.example.com. From RFC 6265 regarding setting a cookie and its Domain attribute: If the domain-attribute is non-empty: If the canonicalized request-host does not domain-match the domain-attribute: Ignore … Read more

Make Android WebView not store cookies or passwords

You can use this to prevent cookies from being stored and clean cookies already stored: CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookies(callback); cookieManager.setAcceptCookie(false); WebView webview = new WebView(this); WebSettings ws = webview.getSettings(); ws.setSaveFormData(false); ws.setSavePassword(false); // Not needed for API level 18 or greater (deprecated)

Sending cookies with postman

I used the postman chrome extension until it became deprecated. Chrome extension is also less usable and powerful than the native postman application. Hence it became very inconvenient to use the chrome extension. I have found another approach: copy any request in chrome/any other browser as a CURL request import to postman copied request save … Read more

WWW server reports error after POST Request by Internet Direct components in Delphi

I’m very sure that I’m POSTing the right data Since it does not work – obviously you do not (or Delphi does not – that makes no difference for server). You should start usual debugging loop: Observe reference working behaviour. Observe your program behavior Spot the difference Eliminate the difference Check if the program works … Read more