I have an ASP.NET web project. I want to be able to define all of the links for the site inside my web.config file so that they can be changed easily if needs be. Currently I have an "" section in my web.config file.
How do I bind this key value pair to an '' tag in my .aspx file?!
<appSettings>
<add key="MyNewLink" value="http://someurl.co.uk/" />
</appSettings>
Help greatly appreciated.
Sorry I should have mentioned that this is for a html link: **<a href></a>**
In your aspx file it would be:
NavigateUrl='<%$ AppSettings:MyNewLink %>'
and the full <a> tag is defined as:
<a runat="server" href="<%$ AppSettings:MyNewLink %>">Text link</a>
This syntax can only be used on an ASP.NET WebForms server control.
Isn't this what a .sitemap file is for?
Anyway, as far as I know, you will have to 'bind' this from code behind. Something like:
hlYourLink.NavigateUrl = ConfigurationManager.AppSettings["MyNewLink"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With