Here is my problem:
I have a due date in Web.config <add key="DueDate" value="20161021"/>
how can I create a class that will read the data which is in the web.config, and make it available to any other class that wishes to use it?
Hi florenz,
You can access the web config value like below.
In Razor view
@System.Configuration.ConfigurationManager.AppSettings["DueDate"]
In Controller
var dueDate = System.Configuration.ConfigurationManager.AppSettings["DueDate"].ToString();
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.