Read Variable from Web.Config

后端 未结 6 1783
谎友^
谎友^ 2020-12-14 05:20

How can I add and read the value from web.config file?

6条回答
  •  不思量自难忘°
    2020-12-14 06:01

    Assuming the key is contained inside the node:

    ConfigurationSettings.AppSettings["theKey"];
    

    As for "writing" - put simply, dont.

    The web.config is not designed for that, if you're going to be changing a value constantly, put it in a static helper class.

提交回复
热议问题