Base solution for your next web application
Open Closed

Can I access web.config's configuration value in app project #2154


User avatar
0
omital created

Can I access web.config's configuration value in app project?


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can but you shouldn't. Web application should access the web.config, read the setting value and set it to somewhere. Then you can access it from your app project.

    You can define a class like this.

    public class SettingValues : ISettingValues, ISingletonDependency
    {
        public string Value1 { get; set; }
    
        public string Value2 { get; set; }
    }
    

    create it in your web module's post initialize method (IocManager.Resolve<SettingValues>()) and set the values from web.config. Then you can inject it in your app project and get the values from this class.