Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access web.config settings directly in .aspx page?

I've created a web page and it contains some settings value in Web.Config for example images. So I want to give the path of images in Web.Config file and file name in that particular image src.

I wanted to read that settings only in aspx page not in codebehind.

For example

Below is my code:

Web.Config: <add key="ImagePath" value="http://192.168.0.181/Labeling/Images/"/> 

and in my aspx page,

<img id="ImgHeader" runat="server" src="<%ConfigurationManager.AppSettings["ImagePath"]%>" /> 
like image 473
Sandy Avatar asked Nov 11 '10 09:11

Sandy


1 Answers

<img id="ImgHeader" runat="server" src="<%$ ConfigurationSettings.AppSettings["ImagePath"] %>" /> 

Should do the trick.

like image 144
Neil Knight Avatar answered Sep 28 '22 03:09

Neil Knight