I am looking to write code to open and edit the base web.config files for a machine (as part of an installer for an HttpModule).
the files i want to edit are located commonly at:
- C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
- C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config
If i use the following code i can open the 32bit version of the file:
Configuration configuration = WebConfigurationManager.OpenWebConfiguration(null);
How do i open the 64 bit version of the file? (regardless of where it has been installed, even if it is installed elsewhere on a machine).
UPDATE: The code in question is for an installer that adds an GAC assembly reference, HttpModule, and HttpHandler to the base web.config of a machine. As the Module is designed to be used on a "whole server" basis, the base web.config is the best place to put this. I REPEAT: THIS IS NOT FOR THE CREATION OF A VIRUS AS PROPOSED IN COMMENTS. The very fact that you need to be running elevated to touch these files should help make this this assumption false.