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

前端 未结 4 1783
时光取名叫无心
时光取名叫无心 2020-12-29 01:46

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

相关标签:
4条回答
  • 2020-12-29 02:18
    <img id="ImgHeader" runat="server" src="<%$ ConfigurationSettings.AppSettings["ImagePath"] %>" />
    

    Should do the trick.

    0 讨论(0)
  • 2020-12-29 02:23
    <%= ConfigurationSettings.AppSettings["ImagePath"] %>
    
    0 讨论(0)
  • 2020-12-29 02:26

    Waqas Iqbal's answer:

    <%$ AppSettings:ImagePath %> 
    

    from Binding ASP.Net Web.Config Settings To .ASPX File <a href></a>? worked nicely!

    0 讨论(0)
  • 2020-12-29 02:39

    This worked for me:

    <%= ConfigurationManager.AppSettings("ImagePath") %>
    
    0 讨论(0)
提交回复
热议问题