An Editor for Web.Config file

Web.config files are found in the root directory of a web application and other sub directories of the web applications. The web.config file found in the sub directories can override the configuration settings found in the parent directories and the machine.config file.



When a user wants to edit the web.config files of a web application it is difficult for them to edit the elements of that XML file and it is not easy to remember all the applicable attributes for a particular element in the web.config file. This is where an editor for web.config file comes in.

There are many editors for web.config file found in the market. We will look at an easy to use product available for editing web.config file. The editor is called Web.Config Editor and its latest version is 2.0. This editor has an easy to use interface for editing the web.config files. This Web.config editor has five resource areas in the interface which are useful for performing multiple tasks.

The specifics discussed are not only applicable to this editor but these should be the features of almost all the web.config editors. Some of the features can be enhanced but these are the basic features that are needed for a web.config editor. The areas of the interface of the web.config editor are:

1. Hierarchy tree:
Used for opening files and hierarchies
2. XML node tree:
Used for navigating the XML nodes of the .config file
3. Node parameters dialogue:
Used for changing the attributes of the elements of the .config file
4. XML source view:
View the XML source of the .config file that you are editing
5. .NET Framework help:
Displays the .Net framework help

The Hierarchy tree area is used for Opening files and opening hierarchies. When working with this area you will have to conscious of what you are looking at. There is a possibility that you may view two types of contents in the hierarchy view. One is the actual contents and the elements and attributes of the actual .config file you are working with.

The other is the view of all the elements and attributes applicable at the level in which you are working with. This view is called the composite view. In composite view editing is not possible. Hence you have to come to the editing view to edit the elements and attributes. In the hierarchical view if you open the web.config file in a directory all the web.config files that are inherited from that file and all the parent web.config files related to that file are also displayed. Using the composite view you can edit any one of the web.config files and see the effect of that in other config files. This is the real power of the web.config editor.

The XML node tree is another area of the web.config editor. This area is used to navigate through the XML nodes of the web.config file. It allows you to select any particular node in the tree and view and edit the attributes of the element selected. The edits made to the web.config files can be saved to the document using the File menu in the top. The Save command of the File menu is used to save the changes made to the XML document. It can also be saved using the shortcut “Ctrl + S”. Only after the changes are saved, it is reflected in the primary and the backup files of the document.

The Node parameters dialogue is used to edit the node values and the parameters of the node of the .config files. Once you select a node in the XML Node Tree the parameters corresponding to the node selected are displayed in this area. You can edit these values and save the changes to the .config files.

The XML source view is used to view the source of the .config files as it is found when they are opened in a Notepad. This view gives you all the code of the .config file that is being edited.

The .Net Framework help area displays the details of the element that is edited currently. This feature helps you to know about the element that you are editing.

Files with the extension of .config and .xml only can be opened in the web.config editor. Multiple files can also be opened but only one file can be edited at a time. If you open the web.config file in the application root then the web.config files found in all the sub directories will be opened by the web.config editor in the composite view. You may know that the web.config file is found in the application root.

The web.config file takes backup of the files you are editing automatically. There are three types of backup files found. They are the primary backup files which are backed up once you open a web.config file. The other one is the backup of the previously opened file. This is created when you open a file. The final one is the backup of the previously saved file. This backup is created when you save a file using the editor.

The web.config editor is integrated with the Visual Studio .Net IDE during installation which allows you to use this editor for editing web.config files from within the Visual Studio .Net IDE. If you want to change the default editor for the web.config file, you can just right click the web.config file in the Visual Studio .Net and choose “Open with” option and select the editor of your choice and check the “Set as default” option to make it the default editor.


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.