My application connects to different databases. The connection strings are saved in the user settings. I cannot use the application scope because the data is changed at run-time.
If the user starts the application normally there is no problem. However, if he uses the "Run..."
command from the Start
menu then a different folder in User\AppData\Local\MyApplication
is created containing a different user.config
.
Is there any way to stop or bypass this behavior?
Just find an application (or a shortcut) you want to start, hold the Shift key, and right-click on it. Select Run as different user in the context menu.
RunAs and “Run as different User” allow a user to start an application with different user credentials. When one of these functions is performed, an authentication occurs and a new process will be created with the specified user account.
Use Software Restriction Policies or AppLocker to prevent access to the Runas.exe binary file. Use Group Policy to remove the Run as different user menu item. The Group Policy Object (GPO) changes to User Configuration\Administrative Templates\Start Menu and Taskbar\Show "Run as different user" command on Start.
To “Run as different user” using Context MenuRMB click on any BAT, CMD, EXE, MSC, or MSI file, and choose Run as a different user. 4. Now an app will be running as a new user.
This behavior cannot be avoided.
It seems that Windows does not identify programs started by other programs as the same as programs which are run by the user.
To solve the problem you have to avoid settings made by the ConfigurationManager and create your own files to save data as pointed out in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With