简体   繁体   English

如何更改其他网站的web.config文件?

[英]How to change web.config file of a different web site?

I have 2 web applications: 我有2个Web应用程序:

  1. Main Application 主要用途
  2. Self Portal 自助门户

I want to change the web.config file of the Self Portal from my Main Application . 我想从我的主应用程序更改自助门户的web.config文件。

In the main application I get the Self Portal URL (for example: http://servername/SelfPortal). 在主应用程序中,我获得了自助门户URL (for example: http://servername/SelfPortal).

How can I open its configuration file and edit it? 如何打开其配置文件并进行编辑?

Thanks, Inbal. 谢谢,Inbal。

Since you have access to the filesystem, you can open the .config file as you would with any XML file. 由于可以访问文件系统,因此可以像打开任何XML文件一样打开.config文件。

Using XDocument you can load, manipulate and save the file. 使用XDocument您可以加载,操作和保存文件。

There are other ways to open the file that are strongly typed (look at the ConfigurationManager , the Open*** methods) if needed. 如果需要,还有其他方法可以打开强类型的文件(请查看ConfigurationManagerOpen***方法)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM