ASP.Net/Development/Configuration Settings

Материал из .Net Framework эксперт
Версия от 14:51, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Get value from Configuration Settings

   <source lang="csharp">

<%@ Page Language="VB" %> <html> <head>

  <script runat="server">
     Sub Page_Load()
        Message1.Text &= ConfigurationSettings.AppSettings("machineConfigKey")
        Message2.Text &= ConfigurationSettings.AppSettings("applicationConfigKey")
     End Sub
  </script>

</head> <body>

  <asp:label id="Message1" runat="server">Machine.Config setting: </asp:label>
  
<asp:label id="Message2" runat="server">Web.Config setting: </asp:label>

</body> </html>

<%-- <configuration>

  <appSettings>
     <add key="applicationConfigKey" value="bar"/>
  </appSettings>
  <system.web>
     <authorization>
        <deny users="?"/>
     </authorization>
  </system.web>

</configuration> --%>

      </source>