473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Really noob question about asp:Image control

I was looking over some asp.net code and saw this asp:Image control:

<asp:Image ImageUrl="~/images/logo.gif" runat="server" ID="Image1"/>
What does the tilde (~) mean in the ImageUrl attribute?

Is it some sort of relative addressing? On the design surface, that shows
as an error until I change it to read:

ImageUrl="../../images/logo.gif"

Which makes more sense to me. I have seen the tilde used this way
elsewhere too.

Can you enlighten a poor noob??

Thanks
--
Chris

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 18 '05 #1
2 1352
Hello Chris Dunaway dunawayc[[at]_lunchmeat_sbcglobal[dot]]net,

~ translates to application root. So, if youre website is:

http://localhost/MyWebApp/default.aspx

and you have an image located at http://localhost/MyWebApp/images/foo.gif, <asp:Image ImageUrl="~/images/foo.gif"> translates that path to /MyWebApp/images/foo.gif.

This is very nice for applications that may change their VROOT down the road.
I was looking over some asp.net code and saw this asp:Image control:

<asp:Image ImageUrl="~/images/logo.gif" runat="server" ID="Image1"/>

What does the tilde (~) mean in the ImageUrl attribute?

Is it some sort of relative addressing? On the design surface, that
shows as an error until I change it to read:

ImageUrl="../../images/logo.gif"

Which makes more sense to me. I have seen the tilde used this way
elsewhere too.

Can you enlighten a poor noob??

Thanks

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

--

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #2
On Thu, 27 May 2004 11:52:27 -0700, Matt Berther wrote:
~ translates to application root. So, if youre website is:

http://localhost/MyWebApp/default.aspx

and you have an image located at http://localhost/MyWebApp/images/foo.gif, <asp:Image ImageUrl="~/images/foo.gif"> translates that path to /MyWebApp/images/foo.gif.


Visual Studio does not seem to handle those very well. It just displays a
box with a red X where the image would be displayed. Is there any way to
get VS to display those correctly?

Thanks again for the quick response

--
Chris

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail...
1
by: Chris Fink | last post by:
Hello, Does anyone know of a way to handle broken href image tags either by using the html img tag or the asp:image server control? For example, if my src attribute is broken, I would like to...
6
by: C K | last post by:
What is less expensive/intensive on the server -dynamically writing out my rollovers to an asp:literal, or to use asp:image tags for the images. My image names will be dynamic as I am building a...
0
by: mortb | last post by:
Hi I've created an image control of my own as a decendant of asp:image My problem is that when rendered on the production server (not in my development environment though) this control renders an...
2
by: Gonçalo Boléo | last post by:
I have no need to have server control over an image. What is the best choice to use HTML img tag or asp:image for best performance? thanks, Goncalo Boleo
4
by: R.A.M. | last post by:
Hello, Could anyone help me to handle <asp:Image> click in behind code? I have: <asp:Image ID="DotNETImage" ImageUrl="Images/DotNET_360x280.jpeg" AlternateText="Microsoft .NET version 2.0"...
8
by: MarkAurit | last post by:
I have to display some images kept into a sql server database (image data type) in an asp.net 1.1 page. Is it possible to use an asp control to display the contents of a byte or a MemoryStream?...
3
by: Paul Cheetham | last post by:
Hi, I have an application that will display user-defined images in some asp:image controls. (sets the ImageURL, and is always built from the site root) The problem comes when the images...
5
by: Michael | last post by:
Hello all, how could I rotate a server side image in asp.net and show it in web page? Thanks.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.