开发者

Web.config appsettings

开发者 https://www.devze.com 2022-12-29 09:50 出处:网络
How can I use the k开发者_如何学Cey value that is inside my web.config directly from the asp.net webpage i.e using the <%$ %>See ASP.Net Expressions Overview

How can I use the k开发者_如何学Cey value that is inside my web.config directly from the asp.net webpage i.e using the <%$ %>


See ASP.Net Expressions Overview

Example from that page

Web.config...

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

Then you can use...

<%$ AppSettings: copyright %>


<%= ConfigurationManager.AppSettings["key_name"] %>


I think

<%$Appsettings:KeyName %>

Should do what you need.

This uses the AppSettingsExpressionBuilder described here https://web.archive.org/web/20110107080439/http://www.4guysfromrolla.com/demos/printPage.aspx?path=/articles/022509-1.aspx


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号