views:

258

answers:

1

Hi all,

I manage my application-settings using the setting-designer in VS2008.

"The exact path of the user.config files looks something like this:"

<Profile Directory>\<Company Name>\
 <App Name>_<Evidence Type>_<Evidence Hash>\<Version>\user.config

Is there to a way to customize this path? I would prefer something like this:

<Profile Directory>\<Company Name>\
 <App Name>\<Version>\user.config

I noticed that white-spaces were replaced by underscores in the "Company Name" in the new created folder ("Test Company" --> "Test_Company"). I really wish to turn off this behavior.

You know, I could write a new XML-based setting-handler, but I would like to use the setting-designer.

+1  A: 

You would have to implement your own SettingsProvider to customize the path.

See this Client Settings FAQ

Q: Why is the path so obscure? Is there any way to change/customize it?

A: The path construction algorithm has to meet certain rigorous requirements in terms of security, isolation and robustness. While we tried to make the path as easily discoverable as possible by making use of friendly, application supplied strings, it is not possible to keep the path totally simple without running into issues like collisions with other apps, spoofing etc.

The LocalFileSettingsProvider does not provide a way to change the files in which settings are stored. Note that the provider itself doesn't determine the config file locations in the first place - it is the configuration system. If you need to store the settings in a different location for some reason, the recommended way is to write your own SettingsProvider. This is fairly simple to implement and you can find samples in the .NET 2.0 SDK that show how to do this. Keep in mind however that you may run into the same isolation issues mentioned above .

bja