Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Tuesday, February 19, 2008

Using Web.config hash for variables using add, key, and value

Use configuration (web.config) hash to set variables. First, there is the web.config file section: ...

<configuration>
<appSettings>
<add key="fooLink" value="http://www.foo.htm"/>
</appSettings>
</configuration>
Now in the code-behind I can set a Hyperlink variable as follows:

HyperLinkFoo.NavigateUrl = ConfigurationManager.AppSettings["fooLink"].ToString().ToLower();

No comments: