Web.config Application Settings

How can I use the key value that is inside my web.config directly from the asp.net web page using <% $%>

+3
source share
4 answers

See ASP.Net Expression Overview

Example from this page

Web.config ...

<appSettings>
  <add key="copyright" value="(c)Copyright 2004 Northwind Traders"/>
</appSettings>

Then you can use ...

<%$ AppSettings: copyright %>
+4
source
<%= ConfigurationManager.AppSettings["key_name"] %>
+2
source

I think,

<%$Appsettings:KeyName %>

Must do what you need.

Used here AppSettingsExpressionBuilder, described here http://www.4guysfromrolla.com/demos/printPage.aspx?path=/articles/022509-1.aspx

+1
source
<%= ConfigurationManager.AppSettings["mySetting"] %>
0
source

Source: https://habr.com/ru/post/1744627/


All Articles