473,379 Members | 1,235 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,379 software developers and data experts.

Relative URL

Hi

How do I refernece links so that they work on both my development and live
servers? On my development machine, my web site exists in a virtual
directory so a relative link such as '/images/image1.gif' that works on my
live server doesn't work (because it points back to the root of my website,
not that of my virtual directory)?

Cheers

Alan

Nov 18 '05 #1
4 1412
It works for me both in server-side and my IIS on pc:
<img src='images/image1.gif'>
remove the first "/" and try again, if you've images folder in one level
upper than your files, it works.

Another thing, perhaps you didn't added the file to your project.
if you use visual studio:
select your "images" folder in solotion explorer, right-click|Add|Existing
Item , and then choose your images you want to add to yout project.
"Alan Roberts" <al**@statistixl.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi

How do I refernece links so that they work on both my development and live
servers? On my development machine, my web site exists in a virtual
directory so a relative link such as '/images/image1.gif' that works on my
live server doesn't work (because it points back to the root of my
website,
not that of my virtual directory)?

Cheers

Alan

Nov 18 '05 #2
Hi Saber

Thanks for the advice but this doesn't work for controls etc. I have a
number of controls that use graphics. These controls can occurr on pages at
any level within my site so the relative path to the images folder from them
is different. I need some way to indicate paths relative to the application
root rather than the web server route.

Cheers

Alan

"Saber" <saber[--AT--]maghalat.com> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
It works for me both in server-side and my IIS on pc:
<img src='images/image1.gif'>
remove the first "/" and try again, if you've images folder in one level
upper than your files, it works.

Another thing, perhaps you didn't added the file to your project.
if you use visual studio:
select your "images" folder in solotion explorer, right-click|Add|Existing
Item , and then choose your images you want to add to yout project.
"Alan Roberts" <al**@statistixl.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi

How do I refernece links so that they work on both my development and live servers? On my development machine, my web site exists in a virtual
directory so a relative link such as '/images/image1.gif' that works on my live server doesn't work (because it points back to the root of my
website,
not that of my virtual directory)?

Cheers

Alan



Nov 18 '05 #3
Use "~". ~/images/image1.gif

You will have to use server tags though. Or perhaps the ResolveURL method.

Bob Lehmann

"Alan Roberts" <al**@statistixl.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi

How do I refernece links so that they work on both my development and live
servers? On my development machine, my web site exists in a virtual
directory so a relative link such as '/images/image1.gif' that works on my
live server doesn't work (because it points back to the root of my website, not that of my virtual directory)?

Cheers

Alan

Nov 18 '05 #4
Thanks guys. This seems to work got img tags as well as long as i include
runat=server in them. Is there a similar shortcut that can use within CSS
files?

Alan

"Bob Lehmann" <no****@dontbotherme.zzz> wrote in message
news:ui**************@TK2MSFTNGP11.phx.gbl...
Use "~". ~/images/image1.gif

You will have to use server tags though. Or perhaps the ResolveURL method.

Bob Lehmann

"Alan Roberts" <al**@statistixl.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
Hi

How do I refernece links so that they work on both my development and live servers? On my development machine, my web site exists in a virtual
directory so a relative link such as '/images/image1.gif' that works on my live server doesn't work (because it points back to the root of my

website,
not that of my virtual directory)?

Cheers

Alan



Nov 18 '05 #5

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

Similar topics

5
by: jason | last post by:
Can anyone help me find a solution to quickly working out relative paths to a folder in the root of my server... Although it easy when you go - say - two levels down: .../includes it...
2
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references...
3
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following...
6
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data...
4
by: dropdeadster | last post by:
Trying to line up a tic-tac-toe board type grid of images using style= tags to <img inside a table TD but it's not working, I get more like a set of steps, can I get an explanation of what's wrong...
8
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the...
12
by: Alan Isaac | last post by:
Are relative imports broken in 2.5? Directory ``temp`` contains:: __init__.py test1.py test2.py File contents: __init__.py and test2.py are empty test1.py contains a single line::
15
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...
0
by: Kay Schluehr | last post by:
Since their introduction in Python 2.5 I only reviewed the new "relative import" notation briefly by reading the "What's new in Python 2.5" article. Now I wanted checkout if I get comfortable with...
0
by: Gabriel Genellina | last post by:
En Sat, 18 Oct 2008 05:52:04 -0300, Stef Mientki <stef.mientki@gmail.com> escribió: Why don't you let the caller tell you its own location, using __file__? The above code is too much magic for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.