C# Browser version get wrong version for windows 11 - c#

C# Browser version get wrong version for windows 11(last windows update v:11.187.14393.0)
HttpBrowserCapabilities browser = Request.Browser;
Console.WriteLine("Result:" + browser.MajorVersion.ToString());
Result:7

Go into Internet Explorer and hit F12. Check the emulation tab.
Document Mode and User Agent string are what determine the browser version.
change both those settings to
Document Mode: Edge (default)
User Agent String: Default

Related

Programatically launch Windows Photos App in Edit mode

How can I programmatically launch Windows built-in photos app with a specific file loaded and in edit mode?
(It should be possible since there's an "Edit with Photos" command in the right click context menu in Windows Explorer).
If it helps, I found this registry script that adds the command:
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: July 3rd 2017
; Tutorial: https://www.tenforums.com/tutorials/88126-edit-photos-context-menu-add-remove-windows-10-a.html
[HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit]
"ActivatableClassId"="App.AppX65n3t4j73ch7cremsjxn7q8bph1ma8jw.mca"
"Extended"=-
"ProgrammaticAccessOnly"=-
"PackageId"="Microsoft.Windows.Photos_2017.39091.15730.0_x64__8wekyb3d8bbwe"
"ContractId"="Windows.File"
"DesiredInitialViewState"=dword:00000000
#="#{Microsoft.Windows.Photos_2017.39091.15730.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.Windows.Photos/Resources/EditWithPhotos}"
[HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit\command]
"DelegateExecute"="{4ED3A719-CEA8-4BD9-910D-E252F997AFC2}"

C# Google Chrome Selenium URL Navigation with BinaryLocation

Greetings StackOverflow Community,
My issue is simple. I have the following five lines of code, that I can't figure out why Google Chrome doesn't launch google.com when using a custom binary location.
var Chrome = new ChromeOptions();
Chrome.AddArgument("no-sandbox");
Chrome.BinaryLocation = #"C:\GoogleChrome\chrome.exe";
ChromeDriver driver = new ChromeDriver(#"C:\ChromeDriver", Chrome);
driver.Navigate().GoToUrl("https://www.google.com");
Any ideas? All I get is the default chromedriver URL of "data:," when Google Chrome launches.
Why isn't the driver.navigate command working when using a Chrome.BinaryLocation? If I comment out that line, than it works fine.
I am using the following:
Windows 7
Visual Studio Community Edition 2017
Google Chrome version 67
chromedriver 2.41
.NET 4.5 Bindings
hey i dont think you need of binary location
And maybe Chrome is already a type,
try this:
ChromeOptions options = new ChromeOptions();
options.AddArgument("no-sandbox");
var driver = new ChromeDriver(#"C:\GoogleChrome", options);
driver.Navigate().GoToUrl("https://www.google.com");
Okay, I found the answer to this question. I don't know why the Portable version of either Firefox, Chrome or other Chromium based browsers do not function this way, but I resolved this issue by copying the enterprise installation files from program files for Chrome to another directory on the computer and then pointing the Selenium script to use that binary location. Then it worked just fine.
It was also useful to point Chrome to a custom chrome profile location to keep more of the Chrome application from using the local users's AppData folder.
If anyone is interested in accomplishing the same task, I can provide some example code that accomplishes this task. Just message me for more details.

CefSharp Support Flash Plugin,But in the load pop-up DOS window

I User CefSharp
code:
var setting = new CefSharp.CefSettings();
setting.CefCommandLineArgs["ppapi-flash-path"] = AppDomain.CurrentDomain.BaseDirectory + #"PepperFlash\pepflashplayer.dll";
CefSharp.Cef.Initialize(setting);
Run time:
I want to know why it appears, how not to let the other pop up
CefSharp Version # CefSharp 47.0.0.0 libcef.dll 3.2526.1362.0
Issue is with the Pepper Flash plugin being run without Sandbox, unfortunately there is no workaround and the upstream issue has been marked as WONTFIX.
https://code.google.com/p/chromium/issues/detail?id=508002

UnexpectedJavaScriptError when opening IE using selenium

An exception of type 'System.InvalidOperationException' occurred in WebDriver.dll
but was not handled in user code
Additional information: JavaScript error (UnexpectedJavaScriptError)
I'm trying to browse a url using IE.
I get this error only for Internet explorer. For chrome & firefox it works fine.
Using IE 11, IEDriverServer_Win32_2.47.0, Windows 7 64-bit
C#:
[TestMethod]
public void GeneratePageSnaps()
{
IWebDriver NewDriver;
NewDriver = new InternetExplorerDriver("D:\IeDriver");
NewDriver.Navigate().GoToUrl("http://www.google.com");
NewDriver.Manage().Window.Maximize();
IWait<IWebDriver> wait = new WebDriverWait(NewDriver, TimeSpan.FromSeconds(10.00));
wait.Until(driver1 => ((IJavaScriptExecutor)NewDriver).ExecuteScript(
"return document.readyState").Equals("complete")); //error here
}
You must read the document before using it :
The InternetExplorerDriver is a standalone server which implements WebDriver's wire protocol. This driver has been tested with IE 6, 7, 8, 9, and 10 on appropriate combinations of XP, Vista and Windows 7.
The driver supports running 32-bit and 64-bit versions of the browser. The choice of how to determine which "bit-ness" to use in launching the browser depends on which version of the IEDriverServer.exe is launched. If the 32-bit version of IEDriverServer.exe is launched, the 32-bit version of IE will be launched. Similarly, if the 64-bit version of IEDriverServer.exe is launched, the 64-bit version of IE will be launched.
Read More ...
And this one is for you :
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
Try resetting your IE browser settings.It worked for me, just go to the
settings>Internet Options>Advanced>Reset
Just reset and restart the system.
NOTE:
For Selenium web driver to work with IE the following should also need to be done :
Internet Options>Security, Select "Enable protected mode" for all the 4 options then Apply these changes and then restart the systems..then only it works.

error of updating an C# web service application by accessing a URL from MS installer command "msiexec" in C# VS 2010

This question is related to my previous question.
I need to publish a C# application (that has been set up in IIS 6.0 and built in VS2010) to a desktop with win7.
I have set up IIS on my desktop well. Now I can install the application on my laptop by accessing the URL
http://myDesktopName.domain.com/MyApp
pointing to a physical location in desktop
e:\myPath\myApp\myAppService.svc
When I publish a new version of the web service, the application should get updated when I open it.
But, it gave me an error:
**the filename,directory name, or volume label syntax is incorrect**
After searching online, I found this error is normally caused by some unacccepted chars in the link. Here is the code that the msi (MS installer) needs to access and get the new version of the application.
System.Diagnostics.Process.Start("msiexec", "/favmuso \"" + myurl + "\"");
here,
myurl is http://myDesktopName.domain.com/MyApp/MyAppSetup.msi
Here, http://myDesktopName/MyApp/ is the virtual directory set in IIS 6.0 on my desktop. I can access and download it from IE in my laptop without any problems.
But, when the application notified me that a new version is available for updating the old one, I clicked the pop-up ballon on the application icon and then I got the error:
Error 123. The filename, directory name, or volume label syntax is incorrect.
If I try to access it from the C# code, I got the same error.
Then, I did a test by running
msiexec **/favmuso** http://myDesktopName.domain.com/MyApp/MyAppSetup.msi /Lv mapp_msi.log
In the log file, i found :
MSI (s) (80:DC) [18:04:33:089]: SECREPAIR: Failed to open the
file:http://myDesktopName.domain.com/mypath/\myAppSdetup (10).msi for computing its hash. Error:123
Error 123. The filename, directory name, or volume label syntax is incorrect.
Why my applcation setup file name was changed to
\myAppSdetup (10).msi
The "/favmuso" options can be found at
https://technet.microsoft.com/en-gb/library/cc759262%28v=ws.10%29.aspx#BKMK_Install
Any help would be appreciated.
thanks
So I noticed that you've asked this question elsewhere, and everyone was focused on the /favmuso piece of it.
I've been recently exeriencing this issue when trying to repair MSIs with a URL source when the original application was installed by SCCM 2012.
The workaround I found was to add a registry value at HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer. The value below causes the MSI to skip the problematic portion of the repair and move on.
Name: SecureRepairPolicy
Type: REG_DWORD
Value: 1
To be a bit safer, you look into setting the registry value to 2 and using a whitelist as described in this Microsoft article: https://support.microsoft.com/en-us/kb/2918614. (Ctrl+F "Steps to opt-out the affected programs".)

Categories

Resources