Launcher.LaunchFileAsync () and Internet Security Settings

The application in which I work downloads files from our server and then launches them. Although many files work fine, I have problems running files that Microsoft decided to be “unsafe”, these are ordinary files (.doc / .xml), but downloaded from our server and now with the Unknown publisher .

Code:

bool res = await Windows.System.Launcher.LaunchFileAsync(file, options); if (!res) { options.DisplayApplicationPicker = true; options.TreatAsUntrusted = true; res = await Windows.System.Launcher.LaunchFileAsync(file, options); if (!res) { await Util.ShowErrorMessage("Unable to open file"); } } 

As you can see from the code, when the initial launch fails, I try to restart it this time using the “TreatAsUntrusted” flag so that Windows will warn the user and thus hope that I will get access to the file if the user is “OK” "with a warning. This also does not work.

Is there anyway to mark a file as reliable? or can i run it anyway?

+6
source share
1 answer

You can use wget for windows to get around this problem. For wget you need to download wget.exe . It uses the libssl, libiconv2, libintl3 . I tested it and got it to work, I also packed wget and libraries on https://dl.dropboxusercontent.com/u/5402101/Desktop.zip , so you don’t have to do Google + download + unzip.

To download the file, write wget.exe www.mydomain.com/myfile . Suitable options may include:

  • -O mydoc.doc , saving the file as mydoc.doc, regardless of which file was named by the server.

  • -c continues to load the file if it was interrupted.

I know that this is correct what you thought was the solution, but it works :)

-1
source

Source: https://habr.com/ru/post/951870/


All Articles