Nandkishor
Nandkishor

Reputation: 73

How to insert app settings from web.config into a view template

This is my web.config code

<add key="SiteLogoPath" value="#SiteLogoPath#" />

This is my Template code

<p>#SiteLogoPath#</p>

Upvotes: 2

Views: 700

Answers (1)

Steve
Steve

Reputation: 1768

Assuming your question really boils down to inserting an app setting into a Razor template:

In web.config:

<appSettings>
    <add key="SiteLogoPath" value="#SiteLogoPath#" />
</appSettings>

In your Razor template:

@System.Web.Configuration.WebConfigurationManager.AppSettings["SiteLogoPath"]

Upvotes: 3

Related Questions