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 ...
Related
Using DotNetBrowser in WPF app in Windows 10. When navigating to certain pages that typically save user data and use it in subsequent loads to restore your settings, it doesn't seem to be happening.
See example code here of a very simple implementation. If I use it to browse to Amazon's site and login, after closing and reopening app, I'll need to login again -- in a normal browser like Chrome, it retains my login. Is something missing in the code to enable this similar behavior?
To make it work, I had to set UserDataDirectory when creating engine:
engine = EngineFactory.Create(new EngineOptions.Builder
{
RenderingMode = RenderingMode.HardwareAccelerated,
UserDataDirectory = $"{Environment.ExpandEnvironmentVariables("%AppData%\\MyApp\\Chromium\\User Data")}",
LicenseKey = ConfigurationManager.AppSettings["DotNetBrowserLicenseKey"],
}
.Build());
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
We have an application that runs as service on windows. The service periodically checks for active Internet Explorer instances using SHDocVw.ShellWindows(). With this, we are able to capture the URL in each of the IE instances.
My Question:
Is it possible to find out how the webpage in each of these IE instances were launched. For example -
Did user type in url in IE to load the webpage?
Did the user select the link from another IE tab to launch ?
Did the user launch IE instance from another desktop application like outlook etc
Thank you.
The closest thing I could find to your specific requirement was this also check out the part 2 of the same blog where some edge cases have been discussed.
The part 1 of the blog talks about a registry key named TypedURLs (path: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs) which can be found in the registry editor, the rules of updation of this key are like this:
If a link is copied and pasted from a web page to the URL address bar and the user hits enter, this will also populate the key, as this is akin to physically typing in the entire address. If an invalid address of a webpage or resource that cannot be located is entered, the key will not be populated until either the connection or the request is completed (whether it succeeded or failed). If IE’s Stop function is selected before the connection is finished or the resource is located, the key will not be populated.
It is important to note that websites visited with the browser via hyperlinks, redirects, the IE Favorites menu or the user’s home page will not populate this key. Also, when a user selects to delete their browsing history using IE’s built-in function, this key is cleared.
Hope it helps!
Here is the situation: there has been an application for years. It's old and should not be used. Therefore I created a whole new application to replace the other. Now I want to show a piece of information to the users trying to access the old one (regardless whether already authenticated or, which is more likely, not yet authenticated) and a link to the new one.
I don't want to change anything in the old one or just change as few things as possible, it should stay. So I came up with an idea: why not backing up current Default.aspx and then creating new Default.aspx telling users to try and use the new application (maybe slightly modifying web.config but how?). However, when an unauthenticated user enters ~/Default.aspx, she gets redirected to the login page.
Is it possible to allow unauthenticated users to see this default page without getting redirected to the login page just to give their credentials and then see the default page telling that there is the other application?
Are you just looking to "announce" that users should go to the "new" application (and not do an auto-redirect)?
IF SO, then wouldn't a simple html page that made this announcement be your "linker"?
The reason I'm suggesting .html (instead of an .aspx page) is that if you "don't want to change anything" in the old site, then an html page/file takes it out of the "ASP.Net pipeline" (asp.net will not process it, IIS will) - I'm guessing that the entire old application requires authentication because you mentioned the default.aspx (normally the default document of the web site/application) already requires a login (which is why it redirects).
You can set the "old" application default document to be this (new) standard "announcement" page.
Hth...
I need to launch a browser, do some work and then make the browser navigate to a URL (in that order).
The first part is of course simple and I have a Process object. I am at a loss as to how to later direct it to the target page?
How do I treat the Process as a browser and make it navigate to the desired page?
Any help, pointers, code snippets appreciated.
Instead of launching the browser & then navigating to the page, just tell the OS that you want to run the URL. Windows will pick the correct browser, and navigate the user to the given URL.
System.Diagnostics.Process.Start("http://www.StackOverflow.com");
If you don't need to do this in production, you could use a testing library such as WatiN to do this:
using WatiN.Core;
//Placeholder page to launch initial browser
IE ie = new IE("http://www.google.com");
DoSomeWork();
//Now navigate to the page you want
ie.GoTo("http://stackoverflow.com");
My first instinct for this question was DDE, but it appears that has been decommissioned in Windows Vista so that is no good. Shame, as it was the only consistent mechanism in Windows for Interprocess Communication (IPC)...oh how I miss Arexx on the Amiga.
Anyhow, I believe the following will work but unfortunately, due to the way it works, it launches Internet Explorer irrespective of the configured browser.
If your application has a Form, then create a WebBrowser control on it. Set this to non-visible as we are only making use of its as a launching device rather than to display the web page.
In code, at the point where you want to show a web page, use the following code:
webBrowser1.DocumentText = "window.open('How to launch a browser and later direct it to a page?', 'BananasAreOhSoYummy');";
What this does is to tell the WebBrowser control, which is just the IE in disguise, to open a new window called 'BananasAreOhSoYummy'. Because we have given the window a name, we can use that line repeatedly, with different URLs, to change the page in that particular browser window. (A new window will be opened if the user has happened to close it.)
I will have a think about an approach that honours the user's default browser choice.
If you don't need the actual instance of IE, you can use the System.Windows.Forms.WebBrowser control.
I think instead of sending the browser a url you could send it javascript that would run and direct the browser to a site.
Not sure if this would work but I see no reason why it wouldn't