Creating a Dynamic Hyperlink in ASP.NET using the Web.Config

A user recently asked me that she wanted to create a bunch of hyperlinks whose value comes from a web.config. However she was not able to create the Hyperlink successfully by reading the key pair values. Here's how to do so:


  <appSettings>


    <add key="someurl" value="http://www.dotnetcurry.com" />


  </appSettings>




Now read this entry from the web.config using AppSettings


    <asp:HyperLink ID="HyperLink1" runat="server"


    NavigateUrl="<%$ Appsettings:someurl %>"  Text="Click Here">


    </asp:HyperLink>


1 comment: