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 void LoginInstagram() { NSUrlCache.SharedCache.RemoveAllCachedResponses(); NSUrlCache.SharedCache.MemoryCapacity = 0; NSUrlCache.SharedCache.DiskCapacity = 0; var websiteDataTypes = new NSSet <NSString>(new[] { WKWebsiteDataType.Cookies, WKWebsiteDataType.DiskCache, WKWebsiteDataType.IndexedDBDatabases, WKWebsiteDataType.LocalStorage, WKWebsiteDataType.MemoryCache, WKWebsiteDataType.OfflineWebApplicationCache, WKWebsiteDataType.SessionStorage, WKWebsiteDataType.WebSQLDatabases }); WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) => { for (nuint i = 0; i < records.Count; i++) { var record = records.GetItem <WKWebsiteDataRecord>(i); WKWebsiteDataStore.DefaultDataStore.RemoveDataOfTypes(record.DataTypes, new[] { record }, () => { Console.WriteLine($"deleted: {record.DisplayName}"); }); } }); NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } }
public void ClearBrowserCache() { NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } var websiteDataTypes = new NSSet <NSString>(new[] { //Choose which ones you want to remove WKWebsiteDataType.Cookies, WKWebsiteDataType.DiskCache, WKWebsiteDataType.IndexedDBDatabases, WKWebsiteDataType.LocalStorage, WKWebsiteDataType.MemoryCache, WKWebsiteDataType.OfflineWebApplicationCache, WKWebsiteDataType.SessionStorage, WKWebsiteDataType.WebSQLDatabases }); WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) => { for (nuint i = 0; i < records.Count; i++) { var record = records.GetItem <WKWebsiteDataRecord>(i); WKWebsiteDataStore.DefaultDataStore.RemoveDataOfTypes(record.DataTypes, new[] { record }, () => { Console.Write($"deleted: {record.DisplayName}"); }); } }); }
public void DeleteCookie() { NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } }
void IAuthenticator.ClearAllCookies() { NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } //other option could be to delete only cookies with the following names - "MSISAuth", "MSISAuthenticated", "MSISLoopDetectionCookie" }
public void ClearCookies(string url) { // string yahooCookies = CookieManager.Instance.GetCookie(url); //CookieManager.Instance.RemoveAllCookie(); NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } }
public Task ClearCookiesAsync() { NSHttpCookieStorage storage = NSHttpCookieStorage.SharedStorage; foreach (NSHttpCookie cookie in storage.Cookies) { storage.DeleteCookie(cookie); } return(Task.FromResult(true)); }
public void Clear() { NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); Debug.WriteLine("Cookie" + cookie.Name.ToString() + "Deleted"); } Debug.WriteLine("Total of cookies: " + CookieStorage.Cookies.Length.ToString()); }
private void DeleteCacheandCookies() { NSUrlCache.SharedCache.RemoveAllCachedResponses(); NSHttpCookieStorage storage = NSHttpCookieStorage.SharedStorage; foreach (var item in storage.Cookies) { storage.DeleteCookie(item); } NSUserDefaults.StandardUserDefaults.Synchronize(); }
public void LogOut(string authority, string returnUri) { var authContext = new AuthenticationContext(authority); authContext.TokenCache.Clear(); NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } }
public static void OldClear() { NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; if (CookieStorage.Cookies.Length > 0) { NSUrlCache.SharedCache.RemoveAllCachedResponses(); foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } } }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); var x = (NoteWork.Renderer.Wrenderer)sender; if (e.PropertyName == "Clears" && x.Clears == true) { NSHttpCookieStorage cks = NSHttpCookieStorage.SharedStorage; foreach (var z in cks.Cookies) { cks.DeleteCookie(z); } } }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
public Int32 GetUserID() { Int32 user_id = 0; try { NSHttpCookieStorage storage = NSHttpCookieStorage.SharedStorage; user_id = Convert.ToInt32(storage.Cookies.ToList().Where(w => w.Name.Equals("user_id")).FirstOrDefault().Value.ToString()); /* * UIAlertView _error = new UIAlertView("My Title Text", "user_id: " + user_id , null, "Ok", null); * _error.Show(); */ } catch { } return(user_id); }
public override void ViewDidLoad() { base.ViewDidLoad(); _CookieJar = NSHttpCookieStorage.SharedStorage; foreach (var cookie in _CookieJar.Cookies) { _CookieJar.DeleteCookie(cookie); } JsFiles = new DirectoryInfo(Path.Combine(NSBundle.MainBundle.BundlePath, @"js")) .GetFiles("*.js", SearchOption.AllDirectories) .ToDictionary(x => x.Name, x => File.ReadAllText(x.FullName)); Client = new RestClient(@"https://signin.crm.dynamics.com/portal/signin/signin.aspx"); var req = new RestRequest(); req.AddHeader("User-Agent", @"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.5 Safari/535.2"); Response = Client.Execute(req); _WebView = new UIWebView(); _WebView.LoadFinished += HandleWebViewLoadFinished; _WebView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _WebView.MultipleTouchEnabled = true; _UserNameElement = new EntryElement("UserName: "******"", "*****@*****.**"); _PasswordElement = new EntryElement("Password: "******"", "mscrm2011"); _OrganizationElement = new EntryElement("Organization:", "", "emergedata"); _SubmitElement = new StringElement("Submit", Handle_SubmitButtonClicked); _SubmitElement.Alignment = UITextAlignment.Center; var section = new Section("Login") { _UserNameElement, _PasswordElement, _OrganizationElement, _SubmitElement, }; this.Root.Add(section); }
public override void ViewDidLoad () { base.ViewDidLoad (); _CookieJar = NSHttpCookieStorage.SharedStorage; foreach (var cookie in _CookieJar.Cookies) _CookieJar.DeleteCookie(cookie); JsFiles = new DirectoryInfo(Path.Combine(NSBundle.MainBundle.BundlePath, @"js")) .GetFiles("*.js", SearchOption.AllDirectories) .ToDictionary(x=>x.Name, x=>File.ReadAllText(x.FullName)); Client = new RestClient(@"https://signin.crm.dynamics.com/portal/signin/signin.aspx"); var req = new RestRequest(); req.AddHeader("User-Agent", @"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.5 Safari/535.2"); Response = Client.Execute(req); _WebView = new UIWebView(); _WebView.LoadFinished += HandleWebViewLoadFinished; _WebView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _WebView.MultipleTouchEnabled = true; _UserNameElement = new EntryElement("UserName: "******"", "*****@*****.**"); _PasswordElement = new EntryElement("Password: "******"", "mscrm2011"); _OrganizationElement = new EntryElement("Organization:", "", "emergedata"); _SubmitElement = new StringElement("Submit", Handle_SubmitButtonClicked); _SubmitElement.Alignment = UITextAlignment.Center; var section = new Section("Login") { _UserNameElement, _PasswordElement, _OrganizationElement, _SubmitElement, }; this.Root.Add(section); }
public int CookieHandler(bool DoClear) { int Counter = 0; NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; if (DoClear) { NSUrlCache.SharedCache.RemoveAllCachedResponses(); } foreach (var cookie in CookieStorage.Cookies) { if (cookie.Domain.Equals(App.BaseURL) || App.BaseURL.Contains(cookie.Domain)) { if (DoClear) { CookieStorage.DeleteCookie(cookie); } Counter++; } } return(Counter); }
public override void ViewDidLoad() { base.ViewDidLoad(); loginFacebookButton.TouchUpInside += delegate { Console.WriteLine("presing facebook link"); loginView.SendActionForControlEvents(UIControlEvent.TouchUpInside); }; get_helplbl.TextColor = UIColor.FromRGB(112, 112, 112); back_button.SetTitleColor(UIColor.FromRGB(75, 171, 229), UIControlState.Normal); loginButton.BackgroundColor = UIColor.FromRGB(75, 171, 229); signup_lbl.TextColor = UIColor.FromRGB(112, 112, 112); passwordText.SecureTextEntry = true; Profile.CurrentProfile = null; AccessToken.CurrentAccessToken = null; NSHttpCookieStorage storage = NSHttpCookieStorage.SharedStorage; foreach (NSHttpCookie cookie in storage.Cookies) { if (cookie.Domain == "facebook.com") { storage.DeleteCookie(cookie); } } NSUrlCache.SharedCache.RemoveAllCachedResponses(); var cookies = NSHttpCookieStorage.SharedStorage.Cookies; foreach (var c in cookies) { NSHttpCookieStorage.SharedStorage.DeleteCookie(c); } var websiteDataTypes = new NSSet <NSString>(new[] { //Choose which ones you want to remove WKWebsiteDataType.Cookies, WKWebsiteDataType.DiskCache, WKWebsiteDataType.IndexedDBDatabases, WKWebsiteDataType.LocalStorage, WKWebsiteDataType.MemoryCache, WKWebsiteDataType.OfflineWebApplicationCache, WKWebsiteDataType.SessionStorage, WKWebsiteDataType.WebSQLDatabases }); WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) => { for (nuint i = 0; i < records.Count; i++) { var record = records.GetItem <WKWebsiteDataRecord>(i); WKWebsiteDataStore.DefaultDataStore.RemoveDataOfTypes(record.DataTypes, new[] { record }, () => { Console.Write($"deleted: {record.DisplayName}"); }); } }); NavigationController.NavigationBarHidden = true; this.View.BringSubviewToFront(passwordText); this.View.BringSubviewToFront(emailText); this.View.BringSubviewToFront(back_button); var screenTap = new UITapGestureRecognizer(() => { emailText.ResignFirstResponder(); passwordText.ResignFirstResponder(); }); var show_signup = new UITapGestureRecognizer(() => { ViewModel.ShowSignUp(); }); this.View.AddGestureRecognizer(screenTap); this.signup_lbl.AddGestureRecognizer(show_signup); this.signup_lbl.UserInteractionEnabled = true; back_button.TouchUpInside += (sender, e) => { ViewModel.BackIntroduction(); }; ViewModel.ForPropertyChange(x => x.ErrorMessage, y => { //Debug.WriteLine("PORPOISE LOGO CHANGED"); var okAlertController = UIAlertController.Create("Error message", ViewModel.ErrorMessage, UIAlertControllerStyle.Alert); //Add Action okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // Present Alert PresentViewController(okAlertController, true, null); }); loginButton.TouchUpInside += (sender, e) => { if (!string.IsNullOrEmpty(emailText.Text) && !string.IsNullOrEmpty(passwordText.Text)) { ViewModel.email = emailText.Text; ViewModel.password = passwordText.Text; ViewModel.Login(); } else if (string.IsNullOrEmpty(emailText.Text)) { var okAlertController = UIAlertController.Create("Error message", "Please enter email", UIAlertControllerStyle.Alert); //Add Action okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // Present Alert PresentViewController(okAlertController, true, null); } else if (string.IsNullOrEmpty(passwordText.Text)) { var okAlertController = UIAlertController.Create("Error message", "Please enter password", UIAlertControllerStyle.Alert); //Add Action okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // Present Alert PresentViewController(okAlertController, true, null); } //UsingOauth(); }; Profile.Notifications.ObserveDidChange((sender, e) => { if (e.NewProfile == null) { return; } if (AccessToken.CurrentAccessToken != null) { var request = new GraphRequest("/me?fields=first_name,last_name,name,email,picture,birthday,gender", null, AccessToken.CurrentAccessToken.TokenString, null, "GET"); request.Start((connection, result, error) => { // Handle if something went wrong with the request if (error != null) { //showAlert("Error", error.Description); return; } //fbReponseFromSDK facebookSDKLoginItem = new fbReponseFromSDK(); // Get your profile name var userInfo = result as NSDictionary; if (userInfo["id"] != null) { ViewModel.provider_id = userInfo["id"].ToString(); ViewModel.user_login_provider.user_provider_id = userInfo["id"].ToString(); Console.WriteLine("id is: " + userInfo["id"].ToString()); } if (userInfo["name"] != null) { ViewModel.user_login_provider.user_provider_name = userInfo["name"].ToString(); Console.WriteLine("name is: " + userInfo["name"].ToString()); } if (userInfo["first_name"] != null) { ViewModel.first_name = userInfo["first_name"].ToString(); Console.WriteLine("first_name is: " + userInfo["first_name"].ToString()); } if (userInfo["last_name"] != null) { ViewModel.last_name = userInfo["last_name"].ToString(); Console.WriteLine("last_name is: " + userInfo["last_name"].ToString()); } if (userInfo["email"] != null) { ViewModel.email = userInfo["email"].ToString(); Console.WriteLine("email is: " + userInfo["email"].ToString()); } if (userInfo["picture"] != null) { Console.WriteLine("profile image is: " + userInfo["picture"].ToString()); } if (userInfo["birthday"] != null) { var formatted = DateTime.Parse(userInfo["birthday"].ToString()); ViewModel.birth_date = formatted.ToString("yyyy-MM-dd"); Console.WriteLine("birthday is: " + userInfo["birthday"].ToString()); } if (userInfo["gender"] != null) { if (userInfo["gender"].Equals("male")) { ViewModel.gender = "MALE"; } else if (userInfo["gender"].Equals("female")) { ViewModel.gender = "FEMALE"; } Console.WriteLine("gender is: " + userInfo["gender"].ToString()); } //(Success) Do what you want next : //doneFacbookLogin(); //loginView.LoggedOut(); ViewModel.user_login_provider.provider = "FACEBOOK"; ViewModel.EmailVerification(); }); } nameLabel.Text = e.NewProfile.Name; }); // Set the Read and Publish permissions you want to get loginView = new LoginButton(new CGRect(0, 0, loginFacebookButton.Frame.Width, loginFacebookButton.Frame.Height)) { //LoginBehavior = LoginBehavior., Permissions = readPermissions.ToArray() }; var attributes = new UIStringAttributes { BackgroundColor = UIColor.FromRGB(75, 171, 229), ForegroundColor = UIColor.White, Font = UIFont.FromName("System Semibold", 17f) }; var titleText = new NSAttributedString("Log In With Facebook", attributes); loginView.SetAttributedTitle(titleText, UIControlState.Normal); loginView.SetBackgroundImage(null, UIControlState.Normal); loginView.BackgroundColor = UIColor.FromRGB(75, 171, 229); // Handle actions once the user is logged in loginView.Completed += (sender, e) => { if (e.Error != null) { // Handle if there was an error } if (e.Result.IsCancelled) { // Handle if the user cancelled the login request } // Handle your successful login }; // Handle actions once the user is logged out loginView.LoggedOut += (sender, e) => { Profile.CurrentProfile = null; // Handle your logout }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView(new CGRect(50, 50, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel(new RectangleF(20, 319, 280, 21)) { TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.Clear }; // Add views to main view Console.WriteLine(); loginFacebookButton.BackgroundColor = UIColor.FromRGB(75, 171, 229); //loginFacebookButton.AddSubview(loginView); }
public static void log_out() { string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var cards_cache_dir = Path.Combine(docs, Constants.CardsPersonalImages); var logo_cache_dir = Path.Combine(docs, Constants.CardsLogo); var QRs_cache_dir = Path.Combine(docs, Constants.QRs_cache_dir); #region clearing tables, variables and photos if (Directory.Exists(cards_cache_dir)) { Directory.Delete(cards_cache_dir, true); } if (Directory.Exists(logo_cache_dir)) { Directory.Delete(logo_cache_dir, true); } if (Directory.Exists(QRs_cache_dir)) { Directory.Delete(QRs_cache_dir, true); } try { SocialNetworkTableViewSource <int, int> .selectedIndexes.Clear(); } catch { } try { SocialNetworkTableViewSource <int, int> .socialNetworkListWithMyUrl.Clear(); } catch { } try { SocialNetworkTableViewSource <int, int> ._checkedRows.Clear(); } catch { } databaseMethods.CleanPersonalNetworksTable(); databaseMethods.ClearCompanyCardTable(); databaseMethods.ClearUsersCardTable(); databaseMethods.ClearValidTillRepeatAfterTable(); databaseMethods.CleanCloudSynTable(); databaseMethods.CleanCardNames(); databaseMethods.CleanEtagTable(); //View.BackgroundColor = UIColor.FromRGB(36, 43, 52); var differentPurposesTable = db.Table <DifferentPurposesTable>(); //clearing table try { foreach (var differentPurposeItem in differentPurposesTable) { databaseMethods.RemoveDifferentPurpose(differentPurposeItem.Id); } } catch { } var loginFromTable = db.Table <LoginedFromTable>(); //clearing table try { foreach (var loginFromItem in loginFromTable) { databaseMethods.RemoveLoginFrom(loginFromItem.Id); } } catch { } var loginAfterTable = db.Table <LoginAfterTable>(); //clearing table try { foreach (var loginAfterItem in loginAfterTable) { databaseMethods.RemoveLoginAfter(loginAfterItem.Id); } } catch { } CropCompanyLogoViewController.currentImage = null; CropCompanyLogoViewController.cropped_result = null; CompanyAddressMapViewController.lat = null; CompanyAddressMapViewController.lng = null; CompanyAddressMapViewController.company_lat = null; CompanyAddressMapViewController.company_lng = null; CompanyAddressViewController.FullCompanyAddressStatic = null; CompanyAddressViewController.country = null; CompanyAddressViewController.region = null; CompanyAddressViewController.city = null; CompanyAddressViewController.index = null; CompanyAddressViewController.notation = null; CompanyDataViewControllerNew.companyName = null; CompanyDataViewControllerNew.linesOfBusiness = null; CompanyDataViewControllerNew.position = null; CompanyDataViewControllerNew.foundationYear = null; CompanyDataViewControllerNew.clients = null; CompanyDataViewControllerNew.companyPhone = null; CompanyDataViewControllerNew.corporativePhone = null; CompanyDataViewControllerNew.fax = null; CompanyDataViewControllerNew.companyEmail = null; CompanyDataViewControllerNew.corporativeSite = null; PersonalDataViewControllerNew.mySurname = null; PersonalDataViewControllerNew.myName = null; PersonalDataViewControllerNew.myMiddlename = null; PersonalDataViewControllerNew.myPhone = null; PersonalDataViewControllerNew.myEmail = null; PersonalDataViewControllerNew.myHomePhone = null; PersonalDataViewControllerNew.mySite = null; PersonalDataViewControllerNew.myDegree = null; PersonalDataViewControllerNew.myCardName = null; try { PersonalDataViewControllerNew.images_list.Clear(); } catch { } PersonalDataViewControllerNew.myBirthdate = null; HomeAddressViewController.FullAddressStatic = null; HomeAddressViewController.myCountry = null; HomeAddressViewController.myRegion = null; HomeAddressViewController.myCity = null; HomeAddressViewController.myIndex = null; HomeAddressViewController.myNotation = null; HomeAddressViewController.FullAddressTemp = null; HomeAddressViewController.myCountryTemp = null; HomeAddressViewController.myRegionTemp = null; HomeAddressViewController.myCityTemp = null; HomeAddressViewController.myIndexTemp = null; HomeAddressViewController.myNotationTemp = null; CompanyAddressViewController.FullCompanyAddressTemp = null; CompanyAddressViewController.countryTemp = null; CompanyAddressViewController.regionTemp = null; CompanyAddressViewController.cityTemp = null; CompanyAddressViewController.indexTemp = null; CompanyAddressViewController.notationTemp = null; try { CreatingCardViewController.datalist.Clear(); } catch { } try { QRViewController.card_names.Clear(); } catch { } NewCardAddressMapViewController.lat = null; NewCardAddressMapViewController.lng = null; EditCompanyDataViewControllerNew.position = null; EditCompanyDataViewControllerNew.logo_id = null; QRViewController.cards_remaining = 0; QRViewController.is_premium = false; QRViewController.ExtraPersonData = null; QRViewController.ExtraEmploymentData = null; QRViewController.CompanyLogoInQr = null; WaitingEmailConfirmViewController.cameFromPurge = false; //clearing webView cookies NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; foreach (var cookie in CookieStorage.Cookies) { CookieStorage.DeleteCookie(cookie); } #endregion clearing tables, variables and photos }