I'm developing an application for windows phone 7. I use WebBrowser control and i want to delete cookies collected during the user navigation. I tried the code below but it doesn't work(currentTab.browser is of type WebBrowser).
foreach (Cookie c in currentTab.browser.GetCookies())
{
c.Discard = true;
c.Expired = true;
c.Expires = DateTime.Now.AddDays(-1D);
}
Any suggestion?
As far as Windows Phone 8 concerned you can use ClearCookiesAsync(); method to clear the cookies.
Related
Is it possible to disable cache for the Webview control for a Windows Phone 8.1 runtime universal app? My App seems to be remembering the information it received the first time. My app logs me into a service and when I go back to rerun app in the emulator (without completing shutting down the emulator) it logs me in automatically rather than giving me the prompt. This behavior is in the NavigationCompleted handler if that helps explain a bit more on where I am hitting this issue.
If I were to shut off the emulator completely and then restart it then I am prompted for the login name and password again. I have gotten over this cache issue, when I was using the HttpClient in other part of my app, by sending the no-cache in the header as:
client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
Can I do something similar for the webview control?
Thank You!
here is the code which I used to clear the cookies which resolved my issue:
Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
var cookieManager = myFilter.CookieManager;
HttpCookieCollection myCookieJar = cookieManager.GetCookies(new Uri("target URI for WebView"));
foreach (HttpCookie cookie in myCookieJar)
{
cookieManager.DeleteCookie(cookie);
}
There is no way to do it programmatically.
But for the test purposes for Windows application you can do it manually - http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN7.
i want my application should work on specific devices\OS like "Lumia 650"\"windows phone 8", this is my project requirement.
Is it possible ? if yes where should I mention the details ?
It is not a problem to restrict Windows Phone 8. You just need to build it targeting Windows Phone OS 8.0.
For the device model you do something like this in the App.xaml.cs
private void Application_Launching(object sender, LaunchingEventArgs e)
{
var deviceName = DeviceExtendedProperties.GetValue("DeviceName").ToString();
if (!deviceName.Contains("Lumia_650")) // Please check your phone's actual value
Application.Current.Terminate();
}
If you want to show a friendly message before it exits you can move the code to the MainPage.xaml.cs then add the MessageBox.Show(message) part.
This is only possible in code as you can not prevent users from installing the app if the app is meant for that particular OS what that user has. However, once the app is launched you can get the name of the device and do actions accordingly.
You can try this:
var PhoneName = Microsoft.Phone.Info.DeviceStatus.DeviceName;
if(PhoneName == "Not Allowed Phone")
{
MessageBox.Show("You can not use this app");
}
else
{
}
i have a code for android below
List<PackageInfo> PackList = getPackageManager().getInstalledPackages(0);
for (int i=0; i < PackList.size(); i++)
{
PackageInfo PackInfo = PackList.get(i);
if ( ( (PackInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) != true)
{
String AppName = PackInfo.applicationInfo.loadLabel(getPackageManager()).toString();
Log.e("App" + Integer.toString(i), AppName);
}
}
above code gets the information of user installed apps.
So my question is simple how to achieve same functionality in windows phone (Native or Hybrid any one)?
This is not possible.There is no such communication existing in the present versions.
Having access to this information would be a potential data privacy issue.
This functionality isn't available for 3rd party apps on Windows Phone 7. You can pass along data using app2app functionality(available only for wp8) (Check this link).
as far as I know You can only get a list of apps on the phone that are published by you. You do not have access to a complete list of apps on the phone.
Please use below code to retrieve information about all packages installed across all users.
IEnumerable<Package> apps = Windows.Phone.Management.Deployment.InstallationManager.FindPackages();
reference link
I have a wp7 app that will play Playready protected live smooth stream.
Before hitting the protected URL, the customData field needs to be set.
I could not find, where to set the customdata in Wp7, whereas in Silverlight app it can be done using below code...
LicenseAcquirer la = new LicenseAcquirer();
la.ChallengeCustomData = "MY_CUSTOMDATA_HERE";
PlaylistItem playlistItem = new PlaylistItem();
playlistItem.LicenseAcquirer = la;
But LicenseAcquirer class does not have ChallengeCustomData field in WP7.
How can then the custom data be set?
Windows Phone 7 is based on a very old version of Silverlight (v3). This version did not have support for sending the PlayReady CustomData element in license requests. I believe what you are trying to accomplish is not possible.
I am writing a Firefox add-on for Linux users to pass credentials for NTLM authenticated sites.some what similar to AutoAuth which is written using XUL framework
https://addons.mozilla.org/en-us/firefox/addon/autoauth/
my question is how to access Authentication Dialog using Firefox SDK?
With the add-on sdk you don't have XUL overlays so only thing you really can do outside of that is to use the window watcher. Since popup windows are considered windows you'll see them in the onTrack function when they popup in the browser.
This example code watches windows looking for the window location chrome://global/content/commonDialog.xul which is similar to what the autoauth add-on is doing. That dialog is used for a number of auth questions so you'll have to do the additional work of detecting NTLM auth.
var { isBrowser } = require("sdk/window/utils");
var delegate = {
onTrack: function (window) {
if (!isBrowser(window) && window.location === "chrome://global/content/commonDialog.xul") {
// this could be the window we're looking for modify it using it's window.document
}
},
onUntrack: function (window) {
if (!isBrowser(window) && window.location === "chrome://global/content/commonDialog.xul") {
// undo the modifications you did
}
}
};
var winUtils = require("window-utils");
var tracker = new winUtils.WindowTracker(delegate);
With this code you're pretty much at the point of the autoauth add-on's load() function. You can use window.document.getElementById() to access the DOM of that window and alter the elements within it.
NOTE That the window-utils module is deprecated so you'll need to keep up with the SDK as they move from that module to (hopefully) something else similar.