Tilde (~) not working in .NET 2 for HyperLink ImageURL

Discussion in 'ASP .Net' started by Nick Gilbert, Feb 28, 2006.

  1. Nick Gilbert

    Nick Gilbert Guest

    Hi,

    I have just migrated my .NET 1.1 site to .NET 2.0. Most things are now
    working except that a lot of my images aren't displaying if they
    referenced the image path using ~.

    eg:

    <asp:hyperlink ID="searchLink" Runat="server"
    NavigateUrl="search.aspx"
    ImageUrl="~/images/search.gif"
    Width="113" Height="20" />

    In .NET 1.1, ~ would cause the image src to be output as:
    "images/search.gif".

    However in .NET 2.0, it outputs the ~ literally as:
    "~/images/search.gif" so obviously the images don't load anymore.

    The only solution I can think of is to manually set the image path in
    code behind and call ResolveURL on the string. This seems REALLY messy
    and will take me hours.

    Why on earth does ~ no longer work in .NET 2.0?

    Nick...
    Nick Gilbert, Feb 28, 2006
    #1
    1. Advertising

  2. Nick Gilbert

    Nick Gilbert Guest

    Don't worry about this thread. It's miraculously started working.

    Love .NET (not).
    Nick Gilbert, Feb 28, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leigh Kendall

    Hyperlink w/ImageUrl bug?

    Leigh Kendall, Jul 29, 2003, in forum: ASP .Net
    Replies:
    8
    Views:
    479
    John Soulis [MSFT]
    Aug 19, 2003
  2. Christian Pické
    Replies:
    0
    Views:
    400
    Christian Pické
    Nov 6, 2003
  3. tshad
    Replies:
    1
    Views:
    2,972
    tshad
    Mar 31, 2005
  4. James T.

    Hyperlink ImageUrl

    James T., Apr 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,052
    Craig Deelsnyder
    Apr 26, 2005
  5. Pat
    Replies:
    2
    Views:
    624
    Göran Andersson
    Nov 6, 2008
Loading...

Share This Page