Looking up environment settings in your web.config file from .aspx pages
Posted by CJ on February 4, 2007
This is a nice way to lookup environment settings in your web.config from your .aspx pages.
See the NavigateUrl property
(ConfigurationManager.AppSettings["AttachmentsPath"]).
<asp:HyperLink ID=”attachmentsHyperLink” runat=”server” NavigateUrl=’<%# ConfigurationManager.AppSettings["AttachmentsPath"] + DataBinder.Eval(Container.DataItem, “Name”).ToString()%>’Target=”_blank”><%#DataBinder.Eval(Container.DataItem,“Name”)%></asp:HyperLink>
You can also do this in .net 1.1 using ConfigurationSettings.AppSettings.
tali said
Hi,
I’ve tried setting the NavigateUrl property as mentioned but an error accures:
Parser Error Message: The server tag is not well formed.
Source Error:
Line 139:
Line 140:
Line 141: <asp:HyperLink ID="lnkOpenFile" runat="server"
Line 142: NavigateUrl=NavigateUrl=''
Line 143: Text="פתח קובץ">
tali said
Hi,
I’ve tried setting the NavigateUrl property as mentioned but an error accures:
Parser Error Message: The server tag is not well formed.
Source Error:
Line 139:
Line 140:
Line 141: <asp:HyperLink ID="lnkOpenFile" runat="server"
Line 142: NavigateUrl=NavigateUrl=''
Line 143: Text="openFile">
tali said
Sorry’
here is the correct error message
Compiler Error Message: BC30516: Overload resolution failed because no accessible 'ToString' accepts this number of arguments.
Source Error:
Line 139:
Line 140:
Line 141: <asp:HyperLink ID="lnkOpenFile" runat="server"
Line 142: NavigateUrl=''
Line 143: Text="פתח קובץ">
tali said
Compiler Error Message: BC30516: Overload resolution failed because no accessible ‘ToString’ accepts this number of arguments.
Source Error:
Line 139:
Line 140:
Line 141: <asp:HyperLink ID=”lnkOpenFile” runat=”server”
Line 142: NavigateUrl=”"
Line 143: Text=”פתח קובץ”>
tali said
tali said
whay can’t i paste the error message correctly