I have this variable defined in my web.config file :
<appSettings>
<add key ="version" value="123"/>
</appSettings>
and I am using it in my aspx pages’ headers without problem:
<link rel="stylesheet" type="text/css" href="../css/style.css?<%= ConfigurationManager.AppSettings["version"] %>"/>
But this doesn’t seem to work in a regular HTML page.
What is the correct way of using a web.config variable in straight HTML ?
Server code (for instance what you have in the
<%%>) can’t be executed on static pages.You need to append this manually in your static pages, or convert them to dynamic pages (
.aspx).<%%>stands for:In a static page which is not routed through the ASP.NET engine, this will not do anything and will not get converted to server code.