简体   繁体   中英

How to use properties.settings.default in <script> _Layout.cshtml

We are trying to use the general properties.settings in our cshtml layout page. The var setting is in the tag (jQuery)

We are able to reach the properties.settings.default.OurSetting in our controller.

We looked at a few questions on SO but they only gave examples to reach it in the controller.

ex: Best practice to save application settings in a Windows Forms Application

How to use settings in Visual C#

http://www.codeproject.com/Articles/17659/How-To-Use-the-Settings-Class-in-C

So we are tried to do

var setting = '@(MyProjectName.Properties.Settings.Default.OurSetting)'

But that says the name Properties does not exist in the current context.

EDIT

We used the appSettings from the web.config first but because we want to be able to change the setting w/o reloading the app.

将Settings.Designer的访问修饰符从内部更改为公共。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM