views:

64

answers:

3

After reading about the differences between appSettings and applicationSettings in a web.config file, I'd rather use the applicationSettings section and benefit from the strongly typed settings. But with the appSettings section, you could previously have a separate section on a different file and simply reference it on the web.config using the 'file=' attribute on the section as so.

I would like to keep my application settings separate from the web.config file so that when the user changes any of the settings, the application is not restarted automatically.

Is there a similar way to achieve this using the new applicationSettings section and benefit from strongly typed settings?

A: 

Use the application's executable name and add .comfig on the end. Then store the file in the same directory.

e.g. myappname.exe.config

There is an excellent article on TechRepublic that details how to do this.

http://articles.techrepublic.com.com/5100-10878_11-1044975.html

Jon Winstanley
Its a web app, there's no exe here. The article you mention talks about the old appSettings, not the new applicationSettings section I'm inquiring about.
Rodolfo G.
Ok no problem. I will leave the answer here in case anyone with an EXE hits this question via a web search.
Jon Winstanley
A: 

this should help

http://stackoverflow.com/questions/1058853/what-is-the-difference-between-the-applicationsettings-section-and-the-appsetting

You can also get strongly typed access to web.config (amongst other things) using http://www.codeproject.com/KB/cs/genuilder.aspx

mcintyre321
That article indeed helped me understand the difference, but still I need to have my applicationSetting on a separate file from the web.config file and there's no example of how to do this on the links you included.
Rodolfo G.
A: 

You can do this via visual studio. The steps are outlined here. msdn link

Hogan
It is all the way at the bottom -- use alternate settings shows you how to make a new settings file.
Hogan
I found a more recent version of this article here: http://msdn.microsoft.com/en-us/library/a65txexh.aspx ... It does indeed indicate you only have to create another .settings file, although my problem is addressed more deeply on this msdn forum post: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/e7848e05-a265-4392-a7f5-35165fec34e5
Rodolfo G.