Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one desktop application to update the website whenever new release comes using this desktop app I want to update "Web.config" file of website programmatically.

Please any one suggest best way for this.

What I have tried:

I tried using Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~"); but in desktop System.Web.Configuration namespace not found.

I have other way using read as xml and than proceed but its not efficient way for Add/Update/Delete configuration tag at any level.
Posted
Updated 29-Aug-18 1:12am

1 solution

There is no support in asp.net for allowing this to happen remotely. If you have file access to the server then do it as a normal file copy, so copy the new config file to

\\servername\sharename\web.config

or

\\ipaddress\c$\inetpub\wwwroot\web.config

or whatever your access is. If your desktop has no file access to the web server then the next easiest approach would be to have an upload function on your website that takes an uploaded web.config file and overwrites the one it has with the uploaded one. Your desktop app would then upload the file to the url programatically using WebClient or whatever. You'd want to consider the security implications of this too.
 
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