How to Access AppSettings in ASPX or ASCX File

Waqas Anwar
10 December 2010

You have web application settings in the section of your web.config, and you want to access them in Web Form (.aspx) File or Web User Control (.ascx) file, you can use appSettings binding expression as shown in the following code.

Suppose you have a setting in web.config
  <add key="LoginButtonText" value="Login" />

You can read setting in aspx or ascx file as follows:
<asp:Button id="Button1" runat="server" Text='<%$ appSettings:LoginButtonText %>'></asp:Button>