Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I convert an NSHttpCookie to a System.Net.Cookie in MonoTouch?
  2. NSHttpCookieStorage.SharedStorage.Cookies
  3.        
  4. System.Net.Cookie
  5.        
  6. NSHttpCookie cookie = NSHttpCookieStorage.SharedStorage.Cookies[0];
  7. System.Net.Cookie newCookie = new System.Net.Cookie()
  8.     {
  9.         Name = cookie.Name,
  10.         Value = cookie.Value,
  11.         Version = (int) cookie.Version,
  12.         Expires = cookie.ExpiresDate,
  13.         Domain = cookie.Domain,
  14.         Path = cookie.Path,
  15.         Port = cookie.PortList[0].ToString(), // is this correct??
  16.         Secure = cookie.IsSecure,
  17.         HttpOnly = cookie.IsHttpOnly
  18.     };
  19.        
  20. var c = cookie.ToCLRCookie ();