Accessing app settings from .aspx page

In aspx page you can access the app setting from web.config in either of the following two ways

1) <a href="<%= ConfigurationManager.AppSettings["Link1"] %>">Link</a>

Here if you want to concat any other information to the retrived value,you can use string.Concat Method

<a href="<%= string.Concat(ConfigurationManager.AppSettings["Link1"] , "/newPage.aspx") %>">Link</a>

2)  <a href="<%$ AppSettings: Link1%>">Link
This is called ASP.NET Expressions.


Gopikrishna

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment