Posted By

housecor on 09/09/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


set and access global config vars in web.config


 / Published in: C#
 

  1. <configuration>
  2. <appSettings>
  3. <add key="websiteName" value="My New Website"/>
  4. </appSettings>
  5.  
  6. Then, to use it, be sure to import:
  7. using System.Configuration
  8.  
  9. And in the body: System.Configuration.ConfigurationManager.AppSettings["websiteName"];
  10.  
  11. OR, in web form, just use Expression syntax:
  12. <asp:Literal Text="<%$AppSettings: websiteName %>" />

Report this snippet  

You need to login to post a comment.