ASP.NET Tutorial/Configuration/ConfigurationSection

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Get section of appSettings as raw xml

   <source lang="csharp">

<%@ page language="C#" %> <script runat="server"> void Page_Load(object sender, System.EventArgs e) {

   string appPath = this.Request.ApplicationPath;    
   Configuration config = Configuration.GetConfigurationForUrl(appPath);
   
   ConfigurationSection section = config.Sections["appSettings"];
   this.textBox1.Text = section.GetRawXml().OuterXml;

}

</script> <html> <head runat="server">

   <title>Untitled Page</title>

</head> <body>

   <form runat="server">
       <asp:textbox id="textBox1" runat="server" textmode="MultiLine" width="300px" height="100px">
       </asp:textbox>
   </form>

</body> </html></source>