I'm developing an UWP app that is using webview and client certificate to login. I have a simple login frame that navigates to Webview frame. When I click login I'm navigated to webview and asked to select one of two certificates that I have in my certificate store. I select first one and I'm successfully logged in. I log out from webview application and navigate to login frame. Now I want to login again and choose a different certificate but I always log in with the first one I have selected. If I close app and start it again, it works like I want it should.
I have tried deleting AC\Microsoft\Crypto, AC\Microsoft\SystemCertificates and AC\Microsoft\CryptnetUrlCache but it doesn't work. I have also tried creating new instance of webview every time I navigate to webview frame but that also doesn't work.
Can anyone help me
Looks like you forgot to clear cookie. Try to clean it with the following method.
Windows.UI.Xaml.Controls.WebView.ClearTemporaryWebDataAsync();
Also check stackoverflow answer Clear all cookies from WebView
Related
I'm new in Xamarin Forms (and in Prism as well) I'm trying to create my first xamarin forms application and need a login flow.
I tried to check if user logged in application.OnInitialized method (and show Login or Main page depending on the result). But the problem is that if i show Login page and then after login i show Main page, then user is able to navigate to login page using hardware buttons..
Then i tried to check this in OnNavigationTo in Main page, but it's not working also. I checked this in PRE version and stable version and had different errors. In one of them the navigation just didn't work, in other - i got an error, that main page couldn't be created.
Then i tried to inject navigation service into MainPage (not a view model), but i found out that navigation service couldn't be injected there.
Then i decided to send a message from view after base.OnAppearing and subscribe to that message in view model and do navigation to login if needed as a callback. But there's one very strange problem. If i'm using ToolBarItems on a MainPage, then on windows phone it's disappearing after navigation back from login page (but suddenly, login page on windows phone HAS that toolbar items), Looks like OnAppearing method on windows phone fires before toolbar items are loaded. In any case, it's not a solution.
Then i decided to add a blank page and send a message after base.onAppearing into a view model and inside that view model i do redirect to Login or main page. So, it works with one small "BUT". If i press hardware back button on login page or main page i don't close application as i navigate to blank page which redirects me to login or main page.
Is there a proper way to implement login flow using prism? i really like it as it's very powerful framework..
Thanks in advance!
Keep in mind that OnNavigatedTo only works when using the latest preview version, and calling NavigationService.Navigate. There are a couple of approaches to take here. First you can navigate to MainPage, then check in the OnNavigatedTo. If not logged in, navigate to the LoginPage. You could also just check on App startup. When you show the LoginPage, you can use an absolute URI to replace the entire navigation stack. Essentially what this does is set MainPage = new MainPage().
I have this weird problem my website won't cache the mainsite!
Here is a little overview about what I am trying to do
The first page that is being loaded is the
[DidTheUserLoggedInBefore?.html]
which checks if the user already has logged in or not depending on that result the user will be redirected to
either [LOGIN.html] or [MAINPAGE.HTML]
pretty simple!
But here comes the problem when the user restarts the app in Offline mode the App should redirect immediately to the mainpage (assuming the previous login was a success).
But that doesnt happen at all.
Instead the [DidTheUserLoggedInBefore?.html] from cache was called (which is correct) and starts loading the mainpage which isnt in cache which results in a whitescreen aka my error.
So how do I get my App to cache the Mainpage?
I've tried setting CacheSize to 100, but that didn't changed a thing :(
You can't check if the user has logged in with a .html file... You need some sort of server side language to set a cookie... Anyway this isn't much clear, is your "app" just a webview?
I couldn't let the webview cache more than 2 (simple) webpages...
WebView ignores he offline.manifest.php file too ...
I am building this Website in ASP.NET that needs a Log in with Facebook button (and later with Google) integrated with it to create an account.
I have looked at some great sources like
http://www.aspdotnet-suresh.com/2012/04/aspnet-integrate-facebook-login.html
and
http://facebooksdk.net/docs/web/getting-started/
[1] However, those examples never deal with Masterpages and content placeholders. So when I am trying to integrate them in the content pages, I get errors because for instance the login button called
"fb:login-button scope="email" data-size="large" data-show-faces="false" data-auto-logout-link="true" onlogin="window.location='/Main.aspx'">
Log in with Facebook < fb:login-button>"
is not accepted without the html tag
html xmlns:fb="http://www.facebook.com/2008/fbml">
which I cannot place on a content page anyways.
[2] Also, I want the user to create an account using their Facebook login. The account is really meant to be used as an instance so that a parent can sign up multiple children for a Summer Program, so all I need the application to do is associate the Facebook login with a new/existing account on my application. Any tips on how to handle this would also be greatly appreciated.
[3] Lastly, after a user logs into facebook, I would like to see them redirected to another page. However, in the code-behind file for the page, I cannot use the Facebook attributes that were written in Javascript and since the Facebook button was not an element of the toolbox, I cannot create an event handler for that. Instead, I had to write
onlogin="window.location='/Main.aspx'
within the tags of the Facebook button. This is not ideal because that means everytime I click that Facebook button, it will redirect me to Main.aspx. Meaning that if I were logged into Facebook already, and ran the Web site, I would click on "Log out" and still access the Main.aspx page...
Hope there's someone out there that has been in the same situation... or can help me!
I have been researching this for 12 hours straight now and cannot get anywhere :(
I'm writing a desktop app in C# that has Facebook integration and I'm trying to figure out how to do authentication/login. I have thought of two different approaches:
1. Popup default browser
The user probably is logged into Facebook on their default browser.
Code: System.Diagnostics.Process.Start("http://www.facebook.com/...");
Issues/Questions: How do I control the window location and size (e.g. not show address bar when it starts)? Can I destroy the process after login is complete or even close the window (won't most browsers prompt for window closing if done from javascript?)?
2. Popup specific browser
If I lookup the default browser, I can pass command-line flags to the browser. "..\chrome.exe" --app=http://www.facebook.com/...
Questions: How do I set the window size/location? How do I close the process after login-complete (assuming I know when the login is complete)?
Is there a better way to do this?
very usefull resource in this situation is http://facebooksdk.net/.
Earlier, there was a sample project for desktop application on facebooksdk.net, but it was removed. You can see it here https://github.com/MarkAureliy/facebook-winforms-sample-master
This project is straight for your needs
I'm using this borwser in .net 3.5 winform application, on x86 platform.
http://sourceforge.net/projects/webkitdotnet/
The problem, when I logged in facebook, with this browser, and I've got the data from facebook, and I closed the form, and after I reloaded the form (every control recreated) the facebook logged again. So the session continued. I don't want this, I'would like to begin a new session. Can I disable the cookies of browser, or reset session, or something like this?
public WebBrowserTabPage currentPage;
WebBrowserTabPage page = new WebBrowserTabPage();
tabControl.TabPages.Add(page);
currentPage = page;
currentPage.browser.Navigate(Url);
currentPage.browser is a WebKitBrowser instance.
I've seen about my problem, and I found a variable (CookiesPolicy in WebkitBrowser class. I've set up this to disable cookies, and facebook didn't worked without cookies. I've tried to delete the WebkitBrowser's cookies from hard drive, but I didn't find them. After I've dicovered, there is a memory leak with Webkitbrowser. So I closed the from, but it didn't disposed, and stayed in memory. Finally I solved the problem, I've put the WebkitBrowser in another Project, and I'm running in different Application.
I'm using Inter Process Communication (IPM) for communicating between mother form application and the browser application
After the browsers
Application.Exit();
the session is disposed, and I can sign into facebook again.
Here is the sample code for IPM with named Pipe:
http://www.codeproject.com/Articles/34073/Inter-Process-Communication-IPC-Introduction-and-S