开发者

Web.config appsettings

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜