|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamically load user.configHi - is it possible to load a user.config file?
What I would like to do is to be able to load a user.config file and then set the current properties to the properties within that file. This would then allow the user to download their own user settings. I could of course parse the XML and do it that way, but I thought there may be a better and easier way. Thanks
Show quote
"lee atkinson" wrote: Not sure if this is what you want, but in your app.config or web.config you > Hi - is it possible to load a user.config file? > > What I would like to do is to be able to load a user.config file and > then set the current properties to the properties within that file. > This would then allow the user to download their own user settings. > > I could of course parse the XML and do it that way, but I thought there > may be a better and easier way. > > Thanks > > can reference an user.config file like this: <appSettings file="user.config"> <add key="ConnectionString" Value="..." /> </aapSetting> In your user.config <appSettings> <add key="ConnectionString Value="something else" /? </appSettings> Cheers, Aaron http://aaronfeng.blogspot.com/ Hi Aaron
I should have made it clear it was .NET 2.0 What I did was to copy over the user.config, then call Settings.Reload() Lee "lee atkinson" wrote: For example, if you have a user.config and app.config both files have the > Hi Aaron > > I should have made it clear it was .NET 2.0 > > What I did was to copy over the user.config, then call > Settings.Reload() > > Lee > > ConnectionString property when you do: ConfigurationManager.AppSettings["ConnectionString"]; It will return the value that is stored in the user.config not app.config. Assuming you set it up like I showed you before, and make sure you copy the user.config when you finish compiling (set this in Visual Studio). Sometimes you might need to "touch" the app.config for it to pickup the user.config. This will allow people who have user.config setup use a different configuration. Cheers, Aaron http://aaronfeng.blogspot.com |
|||||||||||||||||||||||