Home > ASP.NET > Get AppSettings value in ASPX page

Get AppSettings value in ASPX page

In my previous post, I’ve shown how to get AppSettings value from the code behind file. Here, I’ll show you how to get AppSettings value directly from the .ASPX page.

The sample below displays the value for “MyAppSettings” key stored in web.config file as the text for a label named “Label1”.

 

Code for ASPX page:

<asp:Label Text='<%$ AppSettings:MyAppSettings %>’ runat="server" ID="Label1" />

Code in web.config:

<appSettings>
        <add key="MyAppSettings" value="Some value" />
</appSettings>

Advertisements
Categories: ASP.NET Tags: , ,
  1. January 30, 2013 at 3:47 am

    Its better to be html webpage rather than aspx.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: