Saturday, March 31, 2012

Web Config File Editing in ASP.Net 2.0

I am attempting to put a screen in a web application that allows editing
of AppSettings values in the Web.Config file using the Web Configuration
manager class however on he .Save i get an access denied exception.

What could be causing this exception and what should i be looking at to
fix the problem.

Many Thanks

Stuart

*** Sent via Developersdex http://www.developersdex.com ***In the .Net Framework 1.1 ( you *are* using the .Net Framework 1.1?), you
cannot edit configuration files programmatically. The good news is, in the
..Net Framework 2.0, you can, within certain limits.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

"Stuart Ferguson" <stuart_ferguson1@.btinternet.com> wrote in message
news:%233%23Zkv35FHA.2036@.TK2MSFTNGP14.phx.gbl...
>I am attempting to put a screen in a web application that allows editing
> of AppSettings values in the Web.Config file using the Web Configuration
> manager class however on he .Save i get an access denied exception.
> What could be causing this exception and what should i be looking at to
> fix the problem.
> Many Thanks
> Stuart
> *** Sent via Developersdex http://www.developersdex.com ***
I believe Stuart is using 2.0.

Have you taken a look at what the Configuration Application Block offers?
http://msdn.microsoft.com/library/d...html/config.asp

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uTnTYK55FHA.2364@.TK2MSFTNGP12.phx.gbl...
> In the .Net Framework 1.1 ( you *are* using the .Net Framework 1.1?), you
> cannot edit configuration files programmatically. The good news is, in the
> .Net Framework 2.0, you can, within certain limits.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Complex things are made up of
> Lots of simple things.
> "Stuart Ferguson" <stuart_ferguson1@.btinternet.com> wrote in message
> news:%233%23Zkv35FHA.2036@.TK2MSFTNGP14.phx.gbl...
>>I am attempting to put a screen in a web application that allows editing
>> of AppSettings values in the Web.Config file using the Web Configuration
>> manager class however on he .Save i get an access denied exception.
>>
>> What could be causing this exception and what should i be looking at to
>> fix the problem.
>>
>> Many Thanks
>>
>> Stuart
>>
>> *** Sent via Developersdex http://www.developersdex.com ***
Look at the web.config file using file explorer and double check the
permission settings. Compare the write access to the account running
ASP.NET (typically your account (if you are using a file based project
in 2005) or the NETWORK SERVICE account (when using IIS 6).
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 12 Nov 2005 03:26:13 -0800, Stuart Ferguson
<stuart_ferguson1@.btinternet.com> wrote:

>I am attempting to put a screen in a web application that allows editing
>of AppSettings values in the Web.Config file using the Web Configuration
>manager class however on he .Save i get an access denied exception.
>What could be causing this exception and what should i be looking at to
>fix the problem.
>Many Thanks
>Stuart
>*** Sent via Developersdex http://www.developersdex.com ***
I haven't been able to find a page from Microsoft with a link to this most
important document [1] but it discusses changes to write permissions for XML
files as well as other changes implemented by the 2.0 RTM.

For now, I think it best to use this DevX page [2] as a reference which we
can save as a Favorite and easily find and share with others until such time
somebody finds a page from Microsoft with a link rather than a direct
download.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1]
http://download.microsoft.com/downl...%20to%20RTM.doc

[2] http://www.theserverside.net/news/t...thread_id=37383

"Stuart Ferguson" <stuart_ferguson1@.btinternet.com> wrote in message
news:%233%23Zkv35FHA.2036@.TK2MSFTNGP14.phx.gbl...
>I am attempting to put a screen in a web application that allows editing
> of AppSettings values in the Web.Config file using the Web Configuration
> manager class however on he .Save i get an access denied exception.
> What could be causing this exception and what should i be looking at to
> fix the problem.
> Many Thanks
> Stuart
> *** Sent via Developersdex http://www.developersdex.com ***

0 comments:

Post a Comment