appSettings and ConfigurationManager.AppSettings issue

后端 未结 8 1549
情书的邮戳
情书的邮戳 2021-02-12 22:36

I have searched the site, and while I found some very useful information, I couldn\'t figure out what is going on with my code. I have the following web.config:



        
8条回答
  •  梦如初夏
    2021-02-12 23:14

    Have you tried using the WebConfigurationManager:

    return System.Web.Configuration.WebConfigurationManager.AppSettings["APIKey"];
    

    This is the preferred option for using config files in a web app - it handles things like nested config files, etc.

提交回复
热议问题