Click here to Skip to main content
15,906,558 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I want to change the web.config file through c# programmatically. I can able modify the web.config when I am executing the project locally. But I want to modify the web.config file after hosting in IIS. I can able to retrieve all connection strings and appsetting value. But while updating the web.config i can not update. How to do?

I am getting the following error
"Access to the path 'File Name' is denied"

How to solve?
Posted
Updated 11-Jan-12 17:24pm
v2

A simple search returns many results. Take a look at http://www.dotnetspider.com/resources/17562-Edit-Delete-Create-Encrypt-sections.aspx[^] and http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-sharp-net[^].

BTW, why do you want to modify the web.config file. I would probably be taking a different approach to modiying that file programatically.
 
Share this answer
 
Go through this links.,
Here[^]

Configuration Management[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900