public override void LoadingFinished(UIWebView webView) { NSHttpCookieStorage storage = NSHttpCookieStorage.SharedStorage; webView.UserInteractionEnabled = true; var cookieCollection = new CookieCollection(); foreach (var cookie in storage.Cookies) { cookieCollection.Add(new Cookie { Comment = cookie.Comment, Domain = cookie.Domain, HttpOnly = cookie.IsHttpOnly, Name = cookie.Name, Path = cookie.Path, Secure = cookie.IsSecure, Value = cookie.Value, // TODO: Discard = cookie.IsSessionOnly, // ios version is a dictionary, might not be added Version = Convert.ToInt32(cookie.Version) }); // TODO: Expires = cookie.ExpiresDate, // TODO: CommentUri = new Uri(cookie.CommentUrl.AbsoluteString), // TODO: something with the port } _cookieWebView.OnNavigated(new CookieNavigatedEventArgs { Cookies = cookieCollection, Url = webView.Request.Url.AbsoluteString }); }
public override void OnPageFinished(global::Android.Webkit.WebView view, string url) { var cookieHeader = CookieManager.Instance.GetCookie(url); var cookies = new CookieCollection(); var cookiePairs = cookieHeader.Split('&'); foreach (var cookiePair in cookiePairs) { var cookiePieces = cookiePair.Split('='); if (cookiePieces[0].Contains(":")) { cookiePieces[0] = cookiePieces[0].Substring(0, cookiePieces[0].IndexOf(":")); } cookies.Add(new Cookie { Name = cookiePieces[0], Value = cookiePieces[1] }); } _cookieWebView.OnNavigated(new CookieNavigatedEventArgs { Cookies = cookies, Url = url }); }
protected void ControlOnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs navigationEventArgs) { CookieWebView.OnNavigated(new CookieNavigatedEventArgs() { Cookies = Control.GetCookies(), Url = navigationEventArgs.Uri.ToString() }); }
public override void OnPageFinished(Android.Webkit.WebView view, string url) { var cookieHeader = CookieManager.Instance.GetCookie(url); var cookies = new CookieCollection(); var cookiePairs = ParseCookiesFromHeader(cookieHeader); //cookieHeader.Split('&'); foreach (var cookiePair in cookiePairs) { cookies.Add(new Cookie { Name = cookiePair.Key, Value = cookiePair.Value }); } _cookieWebView.OnNavigated(new CookieNavigatedEventArgs { Cookies = cookies, Url = url }); }