AppSettings in the markup question

I am trying to put this in my markup:

<script type="text/javascript" src="<%$ AppSettings:proxyScriptUrl %>"></script>

But for some reason this is not accepted. What am I doing wrong here?

The requirement is that I do not use a helper method, but that expressionbuilder is used in markup.

+2
source share
2 answers

According to the documentation , this is not allowed:

, ASP.NET. , Literal Text . , , :

<p align="center">
  <asp:Literal runat="server" text="<%$ AppSettings: copyright %>"/>
</p>

, aspx:

<script type='text/javascript' src='<asp:Literal id="literal1" runat="server" text="<%$ AppSettings: jsSource %>" />'></script>

- " script".


: . .

+5

, , Config, .

:

<script type="text/javascript" src="<%=Config.ProxyScriptUrl%>"/>

, , ProxyScriptUrl , . :

public static class Config
{
    public static string ProxyScriptUrl 
    {
        get
        {
            return WebConfigurationManager.AppSettings["proxyScriptUrl "];
        }
    }
}
+5

Source: https://habr.com/ru/post/1730266/


All Articles