473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to programmaticaly change the web.config?

Hello group..

Is there a way to change web.config entries at runtime? I haven't
found a class for that.
I have around 20 entries in the web.config, and I want a add a
configuration menu into my app, so that the administrator can change
some of the settings, without editing the web.config directly with a
text editor.
Dec 22 '07 #1
2 1177
Is this any use http://odetocode.com/Articles/418.aspx

Regards,
Mark

On Fri, 21 Dec 2007 20:18:54 -0800 (PST), PS*******@mail.nu wrote:
>Hello group..

Is there a way to change web.config entries at runtime? I haven't
found a class for that.
I have around 20 entries in the web.config, and I want a add a
configuration menu into my app, so that the administrator can change
some of the settings, without editing the web.config directly with a
text editor.
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)

Mark Stevens (mark at thepcsite fullstop co fullstop uk)
Dec 22 '07 #2
The way to go is to put all your setting that can change in a separate file.

Put this line in the <configurationsection on web.config

<appSettings file="MySettings.xml"/>

Having done that, you can access parameteres in MySettings.xml via
ConfigurationManager.AppSettings.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<PS*******@mail.nuwrote in message
news:df**********************************@i3g2000h sf.googlegroups.com...
Hello group..

Is there a way to change web.config entries at runtime? I haven't
found a class for that.
I have around 20 entries in the web.config, and I want a add a
configuration menu into my app, so that the administrator can change
some of the settings, without editing the web.config directly with a
text editor.

Dec 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: who be dat? | last post by:
Hello all. I'm writing an application that is writing trace information that can be viewed in trace.axd. I would like to rename this and use a different name specific to my application. I know...
0
by: Gilles Lambert | last post by:
Hi, I've done a report with the Designer of Crystal Report and it's ok. But the source file (MDB file) will have to move and i d'ont see how to define this info (the connection string would be...
2
by: Erik Juhlin | last post by:
I want to edit a web.confgi file Programmaticaly. I canĀ“t use the System.Configuration.ConfigurationSettings.AppSettings.Add becuase the web.config file i want to edit does belongs to another web...
1
by: Avnish | last post by:
In my c-sharp project, how can i change the application icon property programmatically depending on the configuration selected. i.e. i want to give different icon file path to the application...
0
by: Alias | last post by:
Hi - I have a site that runs on a development and production server. I'd like to programmatically change the connection string the provider uses in the web.config file and have the provider use...
4
by: Dan | last post by:
H, i want to use for one specific application the default membership provider as defined by default in machine.config, except one element: i want to use requiresUniqueEmail="false" instead of...
1
by: Sylvie | last post by:
I am Developing a web application and reading connection strings from Web.Config file, How can I write appSettings keys programmaticaly via a web page ? Thanks <?xml version="1.0"?> ...
3
by: dbuchanan | last post by:
Here is part of the web.config - it is given to me like this. ======================= <configuration> <appSettings/> <connectionStrings> <add name="MyConnectionName" connectionString="Data...
4
by: rvj | last post by:
Anyone know if its possible to create an ASP script to reset the default page of a particular directory
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.