一聚教程网:一个值得你收藏的教程网站

热门教程

Building a Simple ASP.NET Editor for Web Configura

时间:2022-07-02 12:14:06 编辑:袖梨 来源:一聚教程网

In this article, a simple web based editor is built for the web.config file of ASP.NET. This article will cover the basics of the new web.config file structure, as well as helping the reader to understand the configuration file hierarchy of the .NET environment. It will also demonstrate how the XmlDocument object and its methods are used to simply load, modify, and write out XML from a .aspx page . The final code download is a simple web configuration file editor that allows a user to change the configuration settings of a web application through another web application, without needing to have explicit knowledge of the web.config file and it's format. Code Design Motivation
In order to edit the web.config file through the web, the page performing the configuration work needs to be in a separate web application or Application Domain from the web application for which it is changing the configuration settings. This is because of the way ASP.NET deals with configuration file changes. Recall from the explanation above, that when ASP.NET detects changes in the web.config file, it reconfigures itself according to those changes, but allows current requests to finish using the current configuration settings. Given this, it follows that the file performing the configuration would benefit by not changing along with the new configuration settings, as it becomes hard to detect the new changes. This is not to say that the simple web configuration tool will only work in it's own application domain, but results may appear non deterministic at times, and therefore a bit more difficult to debug.

热门栏目