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. 2 1373
Hello Chris Dunaway dunawayc[[at]_lunchmeat_sbcg lobal[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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 image in a
byte of what is in the database.
I also want to be able to display this image in an <asp:image></asp:image>
control.
Is there any way to do this? Most of the examples that I've seen have used
|
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 display an alternate image, ie one that
blends in with the background instead of the standard eye sore x.
I would imagine I could use the <asp:image> server controls events to check
the src and then change it if it is broken, i am just not clear...
|
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 multi-lingual site
(french/english).
Any advice would be appreciated - if there is better way to do this I'd be
open to it as well.
TIA
Clayton
|
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 empty alt attribute
in the resulting image tag.
- Not much of a problem you might think, but the image is contained in a
table cell where the title attribute is set and thus the image's empty alt
tag overrides this title tag.
Has anyone else had...
|
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
| |
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" Width="360" Height="280"
runat="server" />
which I need to handle when clicked. I tried:
|
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?
Thanks much
|
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 specified do not exist, as it displays
a red cross and the alternate text.
What I would like to do is display a default image instead.
|
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.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |