Managing (add/update) user specific configuration setting in WPF application - wpf

I want to manage user specific configuration settings in WPF application configuration file (app.config). While setup (.msi using custom action) I ask user to enter some of the configuration parameters and want to store it in app.config. Also allows user to update these settings through configuration window. I tried following two approaches but didn't working as per expectation.
Approach 1: I added configurable parameters to appSettings section of app.config file. While setup I accepts values for those parameters and write it to app.config using ConfigurationManager. It's working fine. Here configuration are common to all the users.
Issue: Due to Windows 7 OS security unable to write/update configuration parameters value when user run application and modify the same from the configuration window. Since the app.config file stored under "Program Files" Win 7 security not allowing it to modify. It is working fine if I use "run as administrator" option.
Approach 2: Stored configurable settings to Properties.Settings.Default (WPF Project -> Properties -> Settings) which added to app.config file under userSettings/WPFSamples.Properties.Settings section. It has resolved issue with Windows 7 security now user can change the values of configurable parameters from configuration window and it updated to user setting file (C:/Users/DevUser1/AppData/Local) using Properties.Settings.Default. This approach allows to store user specific configuration.
Issue: While setup I accepts configurable values but not able to write it to user configuration file using Properties.Settings.Default (Properties.Settings.Default.Save()). It didn't throwing any exception but it has not been written anywhere since the user settings file (C:/Users/DevUser1/AppData/Local) isn't created until user start the application, modify the configurable parameters and saves it.

Related

Getting Error while adding File System ISE Logic App Connector

I have created an ISE Logic Apps environment, and am trying to add the FileSystem ISE connector to the Managed connectors list, as it does not appear in my default list. When I click on '+Add', I can see the File System connector in the drop down that comes up, but when I select it & click on 'Create', I get the following error:
Failed to create connector 'isefilesystem'
Operation name
Set Integration Service Environment managed API
Time stamp
Mon Jan 13 2020 16:53:24 GMT+0000 (GMT Standard Time)
Event initiated by
xxxxxxxxx#xxxx.xxx
Error code
IntergrationServiceEnvironmentManagedApiDefinitionTagsNotSupported
Message
The tags are not supported in the managed API 'isefilesystem'.
The ISE File System connector is available. The ISE File System connector will not be automatically added to the ISE, you will need to manually add it yourself. Our engineers are working on getting that automatically added with new ISE deployments.
Here are steps from the document to add it manually to the ISE :
On your ISE menu, under Settings, select Managed connectors. On the toolbar, select Add.
On the Add a new managed connector pane, open the Find connector list. Select the ISE connector that you want to use but isn't yet deployed in your ISE. Select Create.
Only ISE connectors that are eligible but not yet deployed to your ISE appear available for you to select. Connectors that are already deployed in your ISE appear unavailable for selection.
Checkout this GitHub issue as well for details.
File system connectors is not yet available in ISE. You can use the shared connector (With gateway) in a Logic app in ISE till it is available.
It is on-premises data gateway. Yes there is already a work items for this and it is in progress and will be there in near future but this timeline is subject to change. As far as new features go, we are not able to disclose much at this time.
Also you could vote up this feedback to promote this feature to be achieved quickly.
I am having problems with the ISE Create File (Preview).
I have an API Connection defined with the Root Folder setting using dot notation, e.g. 192.168.1.23, because there is a DNS issue with hybrid cloud-on-prem lookup, or so I am told.
The Logic App portal editor in Designer mode behaves strangely when configuring the folder path in the Create File action. When using the pop-out folder picker I see "The use name or password is incorrect".
I have made sure that the credentials are correct and have tested successfully via other means.
Is there a work around?
Is this a known issue?

Is it possible to configure `.devcontainer` settings globally?

My development workflow uses one docker container spun up through Docker Compose for all projects.
To the best I can tell the Remote - Container Extension only allows a configuration file to be created per project.
Having the ability to setup the extension either through a global devcontainer.json or in the User settings would be ideal so that:
It can use a docker-compose.yml file external to the project files when attaching to a running container
A user other than root can be set when attaching to the container through the extension
Take advantage that Docker Compose allows you to attach using the container name instead of id, as I rebuild the containers often which causes previous workspaces to fail when attempting to reconnect to the remote.
Perhaps I'm missing something obvious, but I've read through the documentation and also went to the user settings to look through the autocomplete of options. I kind of assumed since devcontainer.json is similar in nature to launch.json it too could be set in User settings, but it was not an available option like "launch" is.

Change and Save Application-scope Settings for next application session In WPF

I'm using both user-scope and application-scope Settings in WPF.
My application usually connects to DB in localhost for developing, but occasionally I need to connect to remote DB server which final application should connect to.
DB Address settings are stored in application-scope Settings.
Application-level Settings cannot be changed during runtime, so I have to open and edit my .config files with Notepad every time whenever I need to before I start the application.
I want to update application-scope Settings in My application at runtime. But need not be applied for the current session, It is okay for the next(and after) application session.
Is there any easy solution to this? If not exist, is it ok to parse and write the .config file directly in my application?
You can have XML or JSON file as settings. Try to read the settings and display it in a window and save the contents again in JSON/XML files.
By the way you can achieve the Application settings read and edit during run time.

Failed to create an object instance for the specified ProgID (WIA.CommonDialog)

We are trying to allow users to scan documents using a Silverlight XAP running in-browser with elevated trust, from a remote server, and are getting the following error:
Unhandled Error in Silverlight Application Failed to create an object instance for the specified ProgID.
The failure is at the following line:
Dim CommonDialog = AutomationFactory.CreateObject("WIA.CommonDialog")
Application.Current.HasElevatedPermissions and AutomationFactory.IsAvailable both return True.
I can successfully create an instance of unsafe ActiveX controls, e.g. Scripting.FileSystemObject:
Dim fso = AutomationFactory.CreateObject("Scripting.FileSystemObject")
The code fails when running from the production environment on the remote server. When running from the ASP.NET Development server from localhost, the code succeeds, and the WIA scanning dialog is shown when calling CommonDialog.ShowAcquireImage().
How can I resolve this? (Is there perhaps something specific about WIA that prevents it from being used this way?) What steps can I take to try and debug this?
Update
When I try to open the generated Silverlight test page (via the file protocol), I get the same error.
Update 2
Process Monitor shows that the AllowLaunchOfElevatedTrustApps and AllowElevatedTrustAppsInBrowser keys are being successfully queried.
Update 3
With Protected Mode turned off, the code works.
The MSDN reference states that to enable COM Interop inside the browser, you must
Set Registry Key HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight\ (or on x64 HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Silverlight\) AllowElevatedTrustAppsInBrowser DWORD 0x0000001
Check your group policy has not disabled AllowInstallOfElevatedTrustApps and AllowLaunchOfElevatedTrustApps
Sign the .xap
Install cert to Trusted Application Store (see screenshots illustrating how)
Additionally, you must
configure as Out of Browser Application (even if you are not running Out of Browser)
before calling the ComAutomationFactory.CreateObject you should check for Application.Current.HasElevatedPermissions and AutomationFactory.IsAvailable
note that Elevated Permission testing from http://localhost and http://127.0.0.1 is not reliable test, as Silverlight runtime makes exception for these two URLs. Instead use file://.
Troubleshooting
Use ProcMon to verify that the AllowElevatedTrustAppsInBrowser registry key is being read
Attach Debugger to Silverlight (see screenshots)
MSIE Protected Mode settings can also adversely affect whether a Silverlight application can run with Elevated Permissions. Try running with different Protected Mode settings.

Per File access Control on Drupal 7 Content

Is there a way to restrict content download "Restricting Anonymous Users From Downloading Files"
Right now, once the user is logged in and he is able to obtain the URL to a path, he can re-download it again even if he logs off.
We've tried
-Rules Module and Content_Access Module to no avail.
it only supports:
Basic Rules per node
There's no
Basic Rules per Content (i.e. videos)
You can control access to files via Drupal only if both conditions are met:
private mode is on (see /admin/config/media/file-system)
Download folder is outside web server access, i.e. file upload folder contents are not accessible from the web.
See hook hook_file_download() which is called for every private file.
Control access to private file downloads and specify HTTP headers.
This hook allows modules enforce permissions on file downloads when the private file download method is selected. Modules can also provide headers to specify information like the file's name or MIME type.

Resources