I have an application which have some specific settings like erroremailid, maxcapcount etc.
I am storing these values in appsetting block. Can anybody tell me which will be better (performance wise) between following two options:
1. Storing settings in web.config
2. Storing settings in normal xml file and then reading them
Some articles specifying the performance difference will also be good.
Thanks
Ashwani
The point is not about performances, why do you think the .NET framework would be any faster in reading one xml file vs another one?
The way .NET works is that certain settings (not only the appSettings section) are retrieved from the application configuration file which is
web.configfor ASP.NET andexefile.exe.configfor executable applications.in executables like windows forms applications you can also save settings from the app at runtime in the config file but in ASP.NET even if the APIs being the same will let you call the save method, the web.config will not be updated as it’s opened as readonly because every time it is changed IIS restarts the web application.
there is no way to imagine that putting some other custom settings in another separated XML file would be any slower or any faster, the advantage vs the web.config would be that you can edit such xml file anytime without the web app to restart as it would happen anytime you save changes in web.config.
still. .NET will get the appSettings from web.config so you can put in another file only other kind of settings and then you have to read those settings yourself by hand, not sure if you can instruct the ConfigurationManager to read from another file.
There are many other sections inside the web.config that are taken by other parts of the application and if you would move them somewhere .NET would not automatically take those for you, for example the default SMTP Server.