Displaying posts categorized under

web.config

Your own configuration setting section in web.config

I have often talked warmly for using appSettings instead of creating your own custom section in web.config – however I do admit there are some pretty nice things with them.
First and maybe most importantly – in a world of component reuse - it is a good way of avoiding name collisions.     
Secondly – it brings structure to your [...]

Appsettings expressions

This is a simple tip, but still might be of value. More of a "good to know you can do it" rather than rocket science.
As you might know, if you have worked with sqldatasources and connectionstrings, you can specify which connectionstring (stored in web.config) to use by using the syntax (in your ASPX file):

<asp:SqlDataSource ID="sql1" [...]

The type or namespace name ‘ConfigurationManager’ does not exist in the namespace

Trying to use
System.Configuration.ConfigurationManager.AppSettings["ConnString"];
from a class library and getting the error it doesn’t exist? You need to add a reference to System.Configuration.dll, cause appearantly Microsoft have moved the AppSettings class out of the System dll.

Connectionstrings in ASP.NET 2.0

By email I was asked about <connectionstrings> in web.config and if it was justified to not use it in certain specific scenarios. While "being used to appSettings" is not enough to me, there could indeed be more complex scenarios and therefore a lot more to it than just "start using it instead".
First, if you like me don’t use [...]