我需要将该web.config appSettings部分的值显示在视图中.
我正在使用<%= Html.Label %>填充
在ASP.NET中,我会使用ConfigurationSettings.AppSettings["FileServer"].
我怎么在MVC中这样做?
wom*_*omp 23
你应该可以使用
<%= ConfigurationManager.AppSettings["FileServer"] %>
Run Code Online (Sandbox Code Playgroud)
在你的视图中.
顺便说一句,ConfigurationSettings已弃用 - 你应该使用ConfigurationManager
小智 5
另一种模式,使用AppSettingsExpressionBuilder.
<asp:Literal ID="Literal1" runat="server" Text="<%$ AppSettings: sample%>" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12554 次 |
| 最近记录: |