Questions tagged [webconfigurationmanager]

41 questions
1
vote
1 answer

Saving changes to web.config using System.Configuration.ConfigurationSection

I have created a custom web config section that I can read and modify successfully at runtime. However, it does not physically change the web.config. If the site is restarted or the pool is recycled I lose my changes and it reverts to the original…
sreimer
  • 4,913
  • 2
  • 33
  • 43
1
vote
1 answer

Changing value on appSettings webconfig. Only works on second pageload

I have below code running. Changing an appSetting in my webconfig. But I have to make a extra pageload to "make the magic". 1st. pageload. uses previous setting. second pageload. Okay. I have it placed inside Page_PreInit : Configuration…
1
vote
0 answers

Elmah not catching WebConfigurationManager.AppSettings[""].ToString() Exception in C#

I have the following code; string sPath = WebConfigurationManager.AppSettings["FilePath"].ToString(); I found that the App Setting 'FilePath' hasn't been declared (doesn't exist), and I'm getting the exception "Object reference not set to an…
neildt
  • 5,101
  • 10
  • 56
  • 107
1
vote
1 answer

How to add section to web config programmatic in SharePoint

I have lot of custom entries to be made in a web config in SharePoint. Is there a way we can do it programatically. such as i have this to add under
1
vote
0 answers

iterate over a "custom" section in web.config

I am creating a verification page so that as my app moves from dev->qa->prod I can verify that all of the settings have been changed in web.config. Looping over the connection strings and app settings was easy enough, but I'm struggling getting the…
1
vote
1 answer

WAP + NUnit + WebConfigurationManager Pin

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…
araaku
  • 265
  • 1
  • 4
  • 10
1
vote
1 answer

WebConfigurationManager reading/writing location path=xx

my web.config contains sections like location -- system.web -- authorization -- allow
1
vote
1 answer

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,…
Matthew Cole
  • 1,329
  • 2
  • 18
  • 30
1
vote
2 answers

read custom config file in asp.net

How do I read connection strings from custom config file (say abc.config) using WebConfigurationManager from asp.net's C# code? Configuration conf = WebConfigurationManager.OpenWebConfiguration("~/abc.config"); This doesn't seem to work.
Sam
  • 933
  • 5
  • 14
  • 26
0
votes
0 answers

VirtualDirectoryMapping missing in .NET 6

I am migrating my application from .NET 4.8 to .NET 6. I unable to find the suitable replacement for this code. Could anyone help me ? VirtualDirectoryMapping vdm = new VirtualDirectoryMapping("some webproject path", true); WebConfigurationFileMap…
0
votes
1 answer

How to do web config settings by another service

I have multiple client and every time when I deployed my web application I have to update web config file for all environment like live, test so I want to add one service that will do auto write web config using the service for all environment how…
0
votes
1 answer

ConfigurationManager could not be found

I have a website based on react for frontend and .net MVC for the backend I want to get the AppSettings methode in the ConfigurationManager, but VS tells me, that there is no ConfigurationManager type name in System.Configuration I have a reference…
0
votes
0 answers

SQLEXPRESS appearing in config connection strings?

I can access the connection strings in my configs like so: var connectionStrings = WebConfigurationManager.ConnectionStrings All the connections in my config are there, but for some reason this list also contains some kind of SQLEXPRESS default…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
0
votes
2 answers

Prevent config files error to render in browser

I have a custom config file in my application say my.config. Suddenly I ecnountered with some error regarding one of the settings inside the config file and the strange thing happens- my content of the config file get's rendered in the browser in…
Rocky Singh
  • 15,128
  • 29
  • 99
  • 146
0
votes
1 answer

Extracting contents of ConnectionStrings in web.config in Silverlight Business application

I am trying to read dataSource ad Catalog from in web.config in Silverlight business project. Unfortunately when I used SqlConnectionStringBuilder, I could not read connection string the has…
webKite
  • 285
  • 3
  • 15