I have a snippet of HTML that I inject into a number of pages throughout my
Web site at runtime. My problem is that I'm not getting the image to appear
in all documents into which this snippet is injected.
If I specify a document-relative path (e.g.,
src="../someFolder/AnotherFolder/TheGraphic.gif" ), then it works fine, but
only for documents that exist at the [someFolder] level in the directory
structure.
I thought I could use a root-relative path, as follows, in order for the
image to appear on all documents throughout my site:
<img src="/someFolder/AnotherFolder/TheGraphic.gif" >
But that doesn't seem to work.
How can I specify the src attribute value in order to have the image show up
correctly on all documents - regardless of the documents location in the
site's folder hierarchy?
Please note that I'm building one simple HTML string that is the same for
all pages into which it is injected - so there is no opportunity or desire
to inject a different string per document.
Thanks! 4 7846
Don't forget about the tilde (~) in ASP.NET. It resolves to the root of your
site. Therefore you can use something like
"~/images/myimage.gif"
from anywhere.
Ken
"Win, Pats" <IJ********@Spa mThis.com> wrote in message
news:ug******** ********@TK2MSF TNGP09.phx.gbl. .. I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected.
If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif" ), then it works fine, but only for documents that exist at the [someFolder] level in the directory structure.
I thought I could use a root-relative path, as follows, in order for the image to appear on all documents throughout my site: <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
But that doesn't seem to work.
How can I specify the src attribute value in order to have the image show up correctly on all documents - regardless of the documents location in the site's folder hierarchy?
Please note that I'm building one simple HTML string that is the same for all pages into which it is injected - so there is no opportunity or desire to inject a different string per document.
Thanks!
Unfortunately the tilde reference to the root doesn't help in my situation
because ASP.NET isn't resolving the path. What I'm doing is simply injecting
a string of HTML into the pages via a Literal control - so it's the browser
that needs to know where the root is...
I thought that starting a path with a '/' causes a path to be
"root-relative" according to HTML fundamentals (as used in the following
<img> tag):
<img src="/someFolder/AnotherFolder/TheGraphic.gif" >
Am I incorrect about that?
"Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. . Don't forget about the tilde (~) in ASP.NET. It resolves to the root of your site. Therefore you can use something like
"~/images/myimage.gif"
from anywhere.
Ken
"Win, Pats" <IJ********@Spa mThis.com> wrote in message news:ug******** ********@TK2MSF TNGP09.phx.gbl. ..I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected.
If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif" ), then it works fine, but only for documents that exist at the [someFolder] level in the directory structure.
I thought I could use a root-relative path, as follows, in order for the image to appear on all documents throughout my site: <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
But that doesn't seem to work.
How can I specify the src attribute value in order to have the image show up correctly on all documents - regardless of the documents location in the site's folder hierarchy?
Please note that I'm building one simple HTML string that is the same for all pages into which it is injected - so there is no opportunity or desire to inject a different string per document.
Thanks!
re: I thought that starting a path with a '/' causes a path to be "root-relative" according to HTML fundamentals
Sure, depending on where the "root" is configured.
Your "root directory" is always going to be wwwroot, if you
haven't configured a downlevel directory as an application.
In that case, "/someFolder/AnotherFolder/TheGraphic.gif"
refers to wwwroot/someFolder/AnotherFolder/TheGraphic.gif.
If you *have* configured an application at /someotherFolder ,
then *that* relative root is /someotherFolder , and a link like
"/someFolder/AnotherFolder/TheGraphic.gif" at *that* location
will refer to
wwwroot/someotherFolder/someFolder/AnotherFolder/TheGraphic.gif
Bottom line is, you can't have the same images directory
for different applications, because the root directory will
vary for each application.
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
=============== ======
"Win, Pats" <IJ********@Spa mThis.com> wrote in message
news:es******** *****@tk2msftng p13.phx.gbl... Unfortunately the tilde reference to the root doesn't help in my situation because ASP.NET isn't resolving the path. What I'm doing is simply injecting a string of HTML into the pages via a Literal control - so it's the browser that needs to know where the root is...
I thought that starting a path with a '/' causes a path to be "root-relative" according to HTML fundamentals (as used in the following <img> tag): <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
Am I incorrect about that? "Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message news:%2******** *******@TK2MSFT NGP15.phx.gbl.. . Don't forget about the tilde (~) in ASP.NET. It resolves to the root of your site. Therefore you can use something like
"~/images/myimage.gif"
from anywhere.
Ken
"Win, Pats" <IJ********@Spa mThis.com> wrote in message news:ug******** ********@TK2MSF TNGP09.phx.gbl. ..I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected.
If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif" ), then it works fine, but only for documents that exist at the [someFolder] level in the directory structure.
I thought I could use a root-relative path, as follows, in order for the image to appear on all documents throughout my site: <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
But that doesn't seem to work.
How can I specify the src attribute value in order to have the image show up correctly on all documents - regardless of the documents location in the site's folder hierarchy?
Please note that I'm building one simple HTML string that is the same for all pages into which it is injected - so there is no opportunity or desire to inject a different string per document.
Thanks!
Thank you so much for the great explanation. The clarafication of "what
specifically is the site root" is was what I was missing.
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:%2******** *******@TK2MSFT NGP14.phx.gbl.. . re: I thought that starting a path with a '/' causes a path to be "root-relative" according to HTML fundamentals
Sure, depending on where the "root" is configured.
Your "root directory" is always going to be wwwroot, if you haven't configured a downlevel directory as an application.
In that case, "/someFolder/AnotherFolder/TheGraphic.gif" refers to wwwroot/someFolder/AnotherFolder/TheGraphic.gif.
If you *have* configured an application at /someotherFolder , then *that* relative root is /someotherFolder , and a link like "/someFolder/AnotherFolder/TheGraphic.gif" at *that* location will refer to wwwroot/someotherFolder/someFolder/AnotherFolder/TheGraphic.gif
Bottom line is, you can't have the same images directory for different applications, because the root directory will vary for each application.
Juan T. Llibre ASP.NET MVP http://asp.net.do/foros/ Foros de ASP.NET en Español =============== ======
"Win, Pats" <IJ********@Spa mThis.com> wrote in message news:es******** *****@tk2msftng p13.phx.gbl... Unfortunately the tilde reference to the root doesn't help in my situation because ASP.NET isn't resolving the path. What I'm doing is simply injecting a string of HTML into the pages via a Literal control - so it's the browser that needs to know where the root is...
I thought that starting a path with a '/' causes a path to be "root-relative" according to HTML fundamentals (as used in the following <img> tag): <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
Am I incorrect about that? "Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message news:%2******** *******@TK2MSFT NGP15.phx.gbl.. . Don't forget about the tilde (~) in ASP.NET. It resolves to the root of your site. Therefore you can use something like
"~/images/myimage.gif"
from anywhere.
Ken
"Win, Pats" <IJ********@Spa mThis.com> wrote in message news:ug******** ********@TK2MSF TNGP09.phx.gbl. .. I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected.
If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif" ), then it works fine, but only for documents that exist at the [someFolder] level in the directory structure.
I thought I could use a root-relative path, as follows, in order for the image to appear on all documents throughout my site: <img src="/someFolder/AnotherFolder/TheGraphic.gif" >
But that doesn't seem to work.
How can I specify the src attribute value in order to have the image show up correctly on all documents - regardless of the documents location in the site's folder hierarchy?
Please note that I'm building one simple HTML string that is the same for all pages into which it is injected - so there is no opportunity or desire to inject a different string per document.
Thanks!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
Is it possible to include my remote web server path eg: m:/html/root/site1
| m:/html/root/site2 etc
....in virtual includes....
Thus eliminating the need to create duplicate INC files in each sub-domain
on my remote web server host domain IP. eg: http://72.3.5.6.0
(www.site1.com; www.site2.com)
I would like to be able to use a UNIVERSAL INC file in the root of my web IP
|
by: Jonathan |
last post by:
I am creating a CD-ROM based website template. Things work fine under
Windows but when I try to run the site under Linux the path is messed
up. Therefore my JavaScript functions misinterpret the root to be the
root of the filesystem instead of the root of the cd. Any cd I make
will need to run on Windows and Linux systems and the filesystems and
the way the cd's are mounted are always different. For example:
Windows root path for a...
|
by: William Stacey [MVP] |
last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ
rooted path (similar to a VDir in IIS). Path.Combine alone will not do the
job in all cases. I also need to be sure the no funny business can go on in
the passed "path" that would produce a path not in the root (i.e.
"..\..\dir1"). Here is my first stab at it, but not sure if this is too
much or not enouph to ensure this. Any thoughts are welcome. TIA.
///...
|
by: Dave |
last post by:
Hi, since I'm developing on XP and can only have on website, how can you
refer to your root application (not web) in your paths?
I read for server controls that "the ~/ prefix will be converted to the
application path as in ASP.NET so that links have the correct path relative
to the web-site root."
However, what do you do about ".css", ".js" links in your html? Dave.
|
by: Jordan Richard |
last post by:
Put another way, is there any way I can tell ASP.NET to convert a path
(imbedded in a string variable, "~/images/some_image.gif") to a
root-relative path, that the client will understand, for the *current* page
request?
Here's what I'm doing: I am injecting HTML directly into ASPX pages via
LiteralControl.
something like this...
| |
by: tsteinke |
last post by:
Okay here is the situation I am developing a ASP.Net application
locally and then I copy the project up to my web server.
I start out by creating an ASP.NET Application
http://localhost/WebApplication
that contains a folder
http://localhost/WebApplication/images
|
by: Steve Franks |
last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the
default ASP.NET Development Web Server it runs using a root address like
this:
http://localhost:11243/testsite/
However when I deploy to a remote test server running real IIS, the real
root of my application becomes:
http://localhost/
What I want to do is have it so that on my local machine the asp.net dev
|
by: ECRIA |
last post by:
Hi All,
We are trying to figure out why PHP's file handling functions refuses to
access the web root using the "/" character on our Windows machines. For
example, a file /test.php is located in our web root. A file in a
subdirectory, say /example/runme.php needs to find out if the file
"/test.php" exists. One would expect that the function
file_exists("/test.php") would return true (it does on our unix host).
However, it returns false...
|
by: Lars Eighner |
last post by:
Aside from the deaths of a few extra electrons to spell out the whole root
relative path, is there any down side? It seems to me that theoretically it
shouldn't make any difference, and it would make it much easier to slap
modualar blocks of markup into page frameworks, which may change and so
forth. And the few extra bytes, which even for a fairly large site would
not amount to as many bytes as are in a fairly small low-res image, should...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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.
| |