Config files can be nice. They can help set settings so that you can tweak things on the fly without having to recompile your code. Or so that non-techies can modify things without having to know your code.
Microsoft uses several config files for .NET. The biggie is Machine.Config. And today I had the pleasure of one of our apps breaking because Nextel changed the phone header information, so .NET didn’t recgonize it anymore. First, when I went into the config file, Microsoft provides a link to a company that is supposed to maintain the browserCaps section. But, of course, that company doesn’t. I’m sure they’d be happy to sell it to you, but the free page .NET links to says “Under Construction”. Nice.
So knowing I was going to have to modify it myself, I start looking for the mobile headers section. I found it, but to give you an idea of what not to do in a config file, I’ll post a *small* snippet of it here:
majorVersion = ${browserMajorVersion}
minorVersion = ${browserMinorVersion}
type = “Phone.com %{majorVersion}.x Browser”
preferredImageMime = “image/vnd.wap.wbmp”
requiresUniqueFilePathSuffix = “true”
type = “Phone.com 3.x Browser”
preferredImageMime = “image/bmp”
requiresUrlEncodedPostfieldValues = “true”
requiresUniqueFilePathSuffix = “true”
canRenderInputAndSelectElementsTogether = “false”
version = %{majorVersion}%{minorVersion}
etc, etc. Let me just say that you should not have code and variables and regex strings all slammed together in a XML Config file. Ugh.