Spanky
Spanky

Reputation: 709

How can I use an appSetting parameter (located in web.config) in my .master template

appSetting parameters I have a value within app settings that I would like to use in my master page file but I think I am using the wrong syntax. Please bear with me because I am very new to Umbraco

My Web.config code is

<appSettings>
    <add key="myKey" value="7829e" />
</appSettings>

The code within my master page is

    <umbraco:Macro runat="server" language="cshtml">
        @AppSetting.myKey
    </umbraco:Macro>

Upvotes: 0

Views: 1075

Answers (1)

Jannik Anker
Jannik Anker

Reputation: 3425

It's not Umbraco related at all, you should be able to do

ConfigurationManager.AppSettings["key"]

Just like you would in standard ASP.NET.

Upvotes: 2

Related Questions