webconfigurationmanager

What's the difference between the WebConfigurationManager and the ConfigurationManager?

What's the difference between the WebConfigurationManager and the ConfigurationManager? When should I use one over the other? UPDATED I just looked at the WebConfigurationManager, and for some reason, you can't access the connection strings as you do in the ConfigurationManager (like an array). Can anyone tell me why MS made it like ...

Problems attempting to read web.config from a Windows application

I'm writing a WPF application to help non-XML-savvy customers set up configuration files on a web server. web.config is one of these files. I have custom sections defined, but I've commented them out until I get the basics working. In web.config, I have this: <appSettings> <add key="buffer" value="65536"/> <add key="updateI...

Can someone provide a quick App.config/Web.config tutorial?

I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"] to get config values. Here are some questions I came up with: What happens when you reference a configu...

Trying to open a section from the web.config spans a ConfigurationErrorsException: The entry KEY has already been added

Hi all, I'm trying to fetch some settings from my membership provider in my asp.net application (so that I don't have to duplicate the information in the appSettings section) but I am getting the following exception: System.Configuration.ConfigurationErrorsException: The entry 'MyMembershipProvider' has already been added. (C:\Inetpub\...

WAP + NUnit + WebConfigurationManager Pin

Hello, I just started using NUnit to write test cases for my asp.net web application project. Some of the code written to access database values fetches the ConnectionString from a "section" defined under "configSections" of web.config file. This works fine during the normal execution of the project on a web browser. But when I access...

Differences in behavior between System.Web.Configuration.WebConfigurationManager and System.Configuration.ConfigurationManager

Hi, I had some trouble on a test server with an ASP.NET website. I goofed, and had the home directory of the Default Web Site pointed to the wrong place. When I tried: ConfigurationManager.ConnectionStrings["connectionString"]; it returned null, but System.Configuration.Configuration rootWebConfig = System.Web.Configuratio...

How to OpenWebConfiguration with physical path?

hi, I have a win form that creates a site in IIS7. One function needs to open the web.config file and make a few updates. (connection string, smtp, impersonation) However I do not have the virtual path, just the physical path. Is there any way I can still use WebConfigurationManager? I need to use it's ability to find section and read...

Loading a ConfigurationSection with a required child ConfigurationElement with .Net configuration framework

I have a console application that is trying to load a CustomConfigurationSection from a web.config file. The custom configuration section has a custom configuration element that is required. This means that when I load the config section, I expect to see an exception if that config element is not present in the config. The problem is t...

Using the WebConfigurationManager.OpenWebConfiguration() function using remote server and port?

Can someone tell me if there is a way for me to use the WebConfigurationManager.OpenWebConfiguration() using a remote server, port and virtual directory? Examples cited in http://msdn.microsoft.com/en-us/library/ms228063.aspx and http://quickstart.developerfusion.co.uk/QuickStart/aspnet/doc/management/mgmtapi.aspx only use the virtual ...

WebConfigurationManager error after adding siteMap

Hello I'm getting this error: Compiler Error Message: CS0118: 'Configuration' is a 'namespace' but is used like a 'type' Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration("~/"); This code has been in place for 5+ months without this issues, only today after adding this sitemap code do I have this issue. <siteMap...

how can i use same web.config file for two web appliction?

hi there, I have two web application. Their folder hierarchy in server is like that. first one is : .../firstapplitaion second is : .../firstapplication/secondapplication/Default.aspx At first can i run them with just firstapplication's web.config file? secondapplication's web config hasnt any special things. Thanks for your helps.. ...

How to retrieve on which site the web application is currently running?

Hello, I am currently running a WCF service on an AppFabric server and my application needs to load a the web.config file dynamically to retrieve custom configuration sections. On my development machine I can just load the configuration like this: WebConfigurationManager.OpenMappedWebConfiguration(webMappedFile, virtualPath); But on...

ASP.NET: HttpRuntime.Cache getting flushed when saving WebConfigurationManager -- Is this a bug?

Recently, I've been experimenting with caching objects with HttpRuntime.Cache and I was generally under the impression that if I "added" something to the cache like this: HttpRuntime.Cache.Insert("Test", "This is a test!", null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, new CacheI...