Tilde Expansion

  • Thread starter Thread starter MB2
  • Start date Start date
M

MB2

I have code in a User Control for an image button like this:
<asp:ImageButton id="__0" runat="server" text="Delete"
ImageUrl="~/Images/ImageLibrary/icon_delete.gif" />

This used to work and it would display the image properly.

However, since installing the latest service pack for the .NET
Framework 1.1, the tilde seems to be expanding improperly. The code
that is expanded to shows this:
<input type="image" name="Template1:_fixed0:_fixed0:_ctl0:Repeater_0:_ctl5:__0"
id="Template1__fixed0__fixed0__ctl0_Repeater_0__ctl5___0"
text="Delete" src="../../Images/ImageLibrary/icon_delete.gif" alt=""
border="0" />

Unfortunately src="../../Images" is not the correct path to that
directory. Does anyone know if Microsoft implemented the tilde
expansion differently than before. Does anyone know if there is a way
around this problem?

Any help is greatly appreciated.

Thanks,
Morry
 
The ~ should link back to the application root which is where the virtual is
defined. So maybe something has changed in the way that you are referencing
the approot?

At the control level this behavior may look different than at the page
level. Take a look at Page.ResolveUrl() and Control.ResolveUrl() which are
used to resolve the ~...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
 
Back
Top