Pages

Saturday, 18 February 2012

Updating the Configuration for a Web Application in ASP.NET 2.0

            After You have opened a configuration file,you can query the various sections of the file,change their properties,and modify configuration values.You can use the Save method to write changes back to the configuration file.The following example shows how to enable the debug featuer

VB


Dim compilation as System.Web.Configuration.CompilationSection
compilation = CType(config.GetSection( " system.web/compilation " ). _
    System.Web.Configuration.CompilationSection )
compilation.Debug  = True
compilation.Save( )

C#


System.Web.Configuration.CompilationSection compilation ;
compilation  = config.GetSection ( " system.web/compilation " ) as
        System.Web.Configuration.CompilationSection ;
compilation.Debug = true ;
compilation.Save( ) ;

No comments:

Post a Comment