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

N

Nick Gilbert

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...
 
N

Nick Gilbert

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

Love .NET (not).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top