Как добавить комментарий в файл web.config во время выполнения в asp.net
Дорогие Все,
Привет, я хочу добавить некоторые комментарии в свой файл web.config во время выполнения.
Значит например
оригинальный веб.файл конфигурации:
<pre lang="xml"><?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <appSettings> <add key="customsetting1" value="Some text here" /> <add key="myKey" value=",1,1,1,1,1,1" /> <add key="RemoveTCPError" value="1,1" /> </appSettings> <connectionStrings> <add name="myDatabaseName" connectionString="whatever" /> </connectionStrings> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true"/> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows"/> <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> </system.web> </configuration>
На какой-то кнопке нажмите,после того как она изменена, как :
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <!-- Note: As an alternative to hand editing this file you can use the \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <appSettings> <add key="customsetting1" value="Some text here" /> <add key="myKey" value=",1,1,1,1,1,1" /> <add key="RemoveTCPError" value="1,1" /> </appSettings> <connectionStrings> <add name="myDatabaseName" connectionString="whatever" /> </connectionStrings> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true"/> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows"/> <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> </system.web> </configuration>
или в любом месте, где в файле web.config должны быть добавлены комм-сети или в любой комментируемой части должен быть добавлен текст.
Возможно ли это?
Пожалуйста,помогите мне.
Заранее всем спасибо.
С уважением,
Ранджит Вадже