4

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?

Rodolfo G.
  • 341
  • 3
  • 10

2 Answers2

0

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.

https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1044975.html

Community
  • 1
  • 1
Jon Winstanley
  • 23,010
  • 22
  • 73
  • 116
  • 1
    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. Nov 23 '09 at 23:54
  • Ok no problem. I will leave the answer here in case anyone with an EXE hits this question via a web search. – Jon Winstanley Nov 24 '09 at 12:07
0

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

Hogan
  • 69,564
  • 10
  • 76
  • 117
  • It is all the way at the bottom -- use alternate settings shows you how to make a new settings file. – Hogan Nov 24 '09 at 00:18
  • 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. Nov 24 '09 at 01:05