Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Thursday, September 14, 2006

Remotely Access to Configuration Files in ASP.NET 2.0

It helped me a lot today.  I knew it's useful but now I'm sure it's twice useful!!

ASP.NET 2.0 comes with a cool new feature that lets you to deal with configuration files on fly via APIs.  You can read a configuration file then modify it through your codes.

Alright, this isn't something new for a real .NET 2.0 developer but I have to point it again!  You can read configuration files from remote server.  System.Web.Configuration.ConfigurationManager.OpenWebConfiguration() method has six overloads that let you to read configuration files locally or remotely then assign them to a Configuration object to modify them.

What will follow is an instance that reads a Community Server configuration file from a server, writes its connectionstring and adds a new AppSettings item then saves the changes.

Source Code Available

Post a Comment