I have several web.config values that I would like to change via a web
page within my ASP.NET 2.0 Web Application Project. Is it possible to
do so, assuming the ASPNET user has filesystem permissions to write to
the file? I thought I could use an XmlTextReader to slurp the file in,
make accept textbox values, use the DOM to change the right values,
and write the file back. If it works, the app would thenautomatically
re-load with the new changes.
Does any of that make sense?
Thanks. 3 1422
An update to the web.config also causes the web application to restart.
Look at the web-based installers for products like Community Server
and DotnetNuke. Those projects also update the web.config, but have
experienced issues with doing it.
Brennan Stehling http://brennan.offwhite.net/blog/
xeroxero wrote:
I have several web.config values that I would like to change via a web
page within my ASP.NET 2.0 Web Application Project. Is it possible to
do so, assuming the ASPNET user has filesystem permissions to write to
the file? I thought I could use an XmlTextReader to slurp the file in,
make accept textbox values, use the DOM to change the right values,
and write the file back. If it works, the app would thenautomatically
re-load with the new changes.
Does any of that make sense?
Thanks.
xeroxero,
You could do it, but the problem is that as soon as you modify the
web.config your ASP.NET application is going to restart, and you may end up
with a real mess on your hands.
Better to use a separate xml file or a database for such settings.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"xeroxero" wrote:
>
I have several web.config values that I would like to change via a web
page within my ASP.NET 2.0 Web Application Project. Is it possible to
do so, assuming the ASPNET user has filesystem permissions to write to
the file? I thought I could use an XmlTextReader to slurp the file in,
make accept textbox values, use the DOM to change the right values,
and write the file back. If it works, the app would thenautomatically
re-load with the new changes.
Does any of that make sense?
Thanks.
xeroxero,
Here is some info you can use:
Search for restart on this page... http://msdn2.microsoft.com/en-us/library/ms228154.aspx http://msdn2.microsoft.com/en-us/lib...alchanges.aspx
What I would do is Peter is suggesting. You can place a configuration
file called custom.config and access it this way...
string configFile =
Path.Combine(HttpContext.Current.Request.PhysicalA pplicationPath,
"custom.config");
Since it ends with .config it will be protected just like Web.config
and any file ending with .config. I use log4net for logging and place
log4net.config into a separate file so that I can reconfigure logging
in a Production setting with restarting the web application.
Brennan Stehling http://brennan.offwhite.net/blog/
xeroxero wrote:
I have several web.config values that I would like to change via a web
page within my ASP.NET 2.0 Web Application Project. Is it possible to
do so, assuming the ASPNET user has filesystem permissions to write to
the file? I thought I could use an XmlTextReader to slurp the file in,
make accept textbox values, use the DOM to change the right values,
and write the file back. If it works, the app would thenautomatically
re-load with the new changes.
Does any of that make sense?
Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mikey_Doc |
last post by:
Hi
We are running cms 2002, Framework 1.0 with Visual studio 2002. We
have just upgraded to Framework 1.1 and visual studio 2003.
All of our database connection strings are stored within the...
|
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...
|
by: Timm |
last post by:
I'm trying to use ASP objects (basically formed and populated based on
Web.Config settings) and I want to use them in a different non-asp program
with minimal reprogramming. So, my question is how...
|
by: Oenone |
last post by:
I am developing an assembly that can be used either by a Windows Forms
application or from within an ASP.NET web site.
When running within the Forms app, I can break into the code while it is...
|
by: Ben |
last post by:
I have a group of settings that I'd like to have inherited by multiple
sites.
I'm trying this, but it's not working.
wwwroot\group\web.config
wwwroot\group\site1\web.config...
|
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= |
last post by:
I've added a web deployment project and want to use the config section
replacement but I'm obviously not understanding something.
I have set up an alternate appSettings file,...
|
by: moondaddy |
last post by:
running vs2005 I have a small test website called TestPublish which has
default.aspx, ErrorPage.aspx and testpage.htm. The default page just says
hello world and no other code and the errorpage...
|
by: =?Utf-8?B?YzY3NjIyOA==?= |
last post by:
Hi all,
I cut and paste the following code from msdn help page which it just
introduces view and multiview server controls.
Here is what I do:
in vs studio 2005, File --New Web Site, it...
|
by: Max2006 |
last post by:
Hi,
In our production environment, we would like to protect our database
connection string against system administrators (they are admin on the web
server box)
I went through this article that...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |