CJ

The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

Looking up environment settings in your web.config file from .aspx pages

Posted by Clayton James 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.

Advertisements

6 Responses to “Looking up environment settings in your web.config file from .aspx pages”

  1. 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="פתח קובץ">

  2. 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">

  3. 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="פתח קובץ">

  4. 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=”פתח קובץ”>

  5. tali said

  6. tali said

    whay can’t i paste the error message correctly

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: