I have a question.
I develop a WPF application using CefSharp v75.1.141 from NuGet.
The application contains several instances of ChromiumWebBrowser with separate containers cookie cache, etc. where each instance is authorized on the site https://web.whatsapp.com/ under different account. On other sites, session are saved and restored successfully, but not at WhatsApp.
WhatsApp, as I understand it, uses cookies, local storage and file system for authorization.
All this seems to be saved on disk, but authorization is always required after a restart.
I tried many configuration options for Cef, but nothing worked.
But if you use Cef in normal mode (without separate storage), everything works fine.
Browser Initialization Code on app startup:
var settings = new CefSettings();
settings.RootCachePath = "Cache";
// For FHD+
Cef.EnableHighDPISupport();
// Initialize cef with the provided settings
Cef.Initialize(settings);
Browser instance setup:
if (UID == null)
UID = Guid.NewGuid().ToString();
var requestContextSettings = new RequestContextSettings
{
CachePath = Path.Combine("Cache", UID),
PersistSessionCookies = true,
PersistUserPreferences = true
};
Browser = new ChromiumWebBrowser("https://web.whatsapp.com/);
Browser.RequestContext = new RequestContext(requestContextSettings);
I really need your help. Ty.
WhatsApp is really.. kinda special. But there's a solution for your problem.
What you need to do is to give WhatsApp Web App little bit more time to process its stuff. Don't close your app too early (give it about 20-40 seconds to let it finish saving data).
Related
How to setup a proxy in c# code for Google Text-To-Speech API.
Does somebody knows where to put in the proxy settings for the Google TTS API in c#. Our project runs locally but not on the server behind a firewall, so it has to go via the proxy.
Hope you have a starting point for me ;-)
Thanks!
The intention is that if you've set the system proxy, or the HTTPS_PROXY environment variable, that should just work by default.
However, at the moment there's a bug in Grpc.Net.Client that causes that to fail. (Once it's been fixed and released, we'll obviously update our dependencies for the next release of Google.Cloud.TextToSpeech.V1 and other Cloud libraries.)
The simplest workaround is probably to still use the Grpc.Net.Client implementation of gRPC, but with an additional option:
var client = new TextToSpeechClientBuilder
{
GrpcAdapter = GrpcNetClientAdapter.Default.WithAdditionalOptions(
options => options.HttpHandler = new HttpClientHandler
{
Proxy = new WebProxy("your proxy here"),
UseProxy = true
})
}.Build();
Hi I'm trying to make a C# app that can check for missing windows updates. I can get my code to work when a user is logged in as that seems to sort out my proxy authentication issues but I want it to run on startup, before a user logs in. Below is my code, it runs fine from visual studio or when I build it and run on another PC but when I set it to run on startup and restart the PC all I get is "System.Runtime.InteropServices.COMException (0x80240438): Exception from HRESULT: 0x80240438 at WUApiLib.IUpdateSearcher.Search(String criteria)"
IUpdateSession uSession = new UpdateSession();
uSession.WebProxy.AutoDetect = false;
uSession.WebProxy.Address = "http://ipAddress:port";
uSession.WebProxy.UserName = #"Domain\user";
string password = "password";
uSession.WebProxy.SetPassword(password);
IUpdateSearcher uSearcher = uSession.CreateUpdateSearcher();
ISearchResult uResult = uSearcher.Search("IsInstalled=0");
Your proxy is probably Active Directory integrated and does not accept this kind of login.
You may try to create a scheduled task which runs in the context of the wanted user and start your code there.
We are creating a desktop application with embedded browser that can connect to conferences at https://meet.jit.si/ We used CefSharp (v 79.1.360) that works fine with audio and camera, except that it does not open "Screen sharing" options. When that web conference is used from a regular Chrome or Firefox, a new popup is displayed with options to share entire desktop or a specific program. Please let me know if that is a settings issue in CefSharp or a limitation of all embedded browsers that they cannot provide screen sharing. Appreciate your help very much in either making this work in CefSharp or in suggesting another Browser control that works.
Settings
CefSettings settings = new CefSettings();
// Add the --enable-media-stream flag
settings.CefCommandLineArgs.Add("enable-media-stream", "1");
settings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing", "1");
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("https://meet.jit.si/");
browser.Dock = DockStyle.Fill;
this.Controls.Add(browser);
// Allow the use of local resources in the browser
BrowserSettings browserSettings = new BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
browser.BrowserSettings = browserSettings;
Apologies if this was asked before.
I am having a rather simple issue, and I am wondering if i am missing something obvious. In my practice Xamarin.Forms app, I am having issue loading the following image source URI: http://lorempixel.com/1920/1080/sports/7/ even though when i go there via my browser; it is fine.
It seems to me like Xamarin needs an image extension for it to work, so for example if i were to have some sort of image online like (https://www.stickpng.com/assets/images/58b061138a4b5bbbc8492951.png , fair warning; this link will download the cat image if you go to it) then it loads up fine.
My question is two fold: Am I missing something simple in my configuration that I need to enable (this is for Android as I don't have an iOS device available atm), and B: Does xamarin even support relative paths?
Code Behind:
var source = new UriImageSource
{
Uri = new Uri("http://lorempixel.com/1920/1080/sports/7/")
};
source.CachingEnabled = false;
ImageOne.Source = source;
Explanation
Both iOS & Android now require https:
Apple will require HTTPS connections for iOS apps by the end of 2016
“Today, I’m proud to say that at the end of 2016, App Transport Security is becoming a requirement for App Store apps,” Apple’s head of security engineering and architecture, Ivan Krstic, said during a WWDC presentation
Android P Will Default to HTTPS Connections for All Apps
[Android P] will default to blocking HTTP traffic in apps by default
Answer
It should be an easy fix - change http to https:
var source = new UriImageSource
{
Uri = new Uri("https://lorempixel.com/1920/1080/sports/7/")
};
source.CachingEnabled = false;
ImageOne.Source = source;
To launch another specific app we can set the other app's package family name:
var options = new LauncherOptions();
options.TargetApplicationPackageFamilyName = packageFamilyName;
Uri uri = new Uri(protocol);
var succeeded = await Windows.System.Launcher.LaunchUriAsync(uri, options);
If the other app wasn't installed, Store download page opens. But this happens only on Windows 10 desktop, on the phone nothing happens, it just fails.
However if we remove options parameter it searches for any app on Store.
await Windows.System.Launcher.LaunchUriAsync(uri);
Is there anyway to have Desktop behavior on Mobile too? I mean open exactly a specific app not any app that registered for that protocol
The documentation states this is for Desktop only at this point in time. Potentially the feature will make it to Mobile (and other Windows flavours) in the future.