due to our applications being moved onto a Citrix VM platform I need to move our application settings config files from C:\ProgramData to an alternative location. With this particular application each user has their own config file, which is effectively a clone of the app.config file but with just user specific content, for example encrypted authentication credentials.
With this in mind, I modified the code to save the config files to a mapped network drive. Using system.configuration I am able to read content without any issues from the networked drive but when I attempt to write changes I get the following error message:
*"Attempted to perform an unauthorized operation."
The following is the function which generates the error:
Public Shared Function WriteSettingUser(ByVal configPath As String, ByVal userName As String, ByVal sectionName As String, ByVal setting As String, ByVal value As String) As String
Dim result As Boolean = False
Dim filemap As New ExeConfigurationFileMap
Dim config As Configuration
Dim section As AppSettingsSection
Try
filemap.ExeConfigFilename = configPath & userName & ".config"
config = ConfigurationManager.OpenMappedExeConfiguration(filemap, ConfigurationUserLevel.None)
section = config.GetSection(sectionName)
section.Settings(setting).Value = value
config.Save()
result = True
Catch ex As Exception
Throw
result = False
Finally
End Try
Return result
The error is generated at the 'config.save' line.
Would appreciate any insight into this issue.
Kind Regards Paul J.