Application Links Settings from usercontrols
In my usercontrol.ascx, I am trying to dynamically generate links using the value I stored in the web.config.
<a href="<%$appSettings.MYPATH%>/file.aspx">link</a>
and when i try to run i get parser error
Literal expressions like '<%$appSettings.MYPATH %>' are not allowed. Use <asp:Literal runat="server" Text="<%$appSettings.MYPATH%>" /> instead.
I know that I probably missed something relatively minor.
+1
a source to share
5 answers
Use a colon instead of a period and add runat="server"
:
<a href="<%$ AppSettings: MYPATH %>/file.aspx">link</a>
The documentation is n't very clear, but ASP.Net expressions are meant to be used in server tags. Thus, if you want to use it in a normal html tag, you must add runat="server"
so that the tag is processed on the server where the expression will be evaluated.
0
a source to share