473,396 Members | 2,121 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,396 software developers and data experts.

Site absolute paths?

I have a need for a site-absolute path specifier (server side).

My issue is that I have pages w/ graphics in the banners (whee!), but the pages
are at different levels of the folder hierarchy. Lastly, the entire site may
or may *not* be at the website root, it all depends on how it was installed.

So, to reference the graphics, I need a way to specify the location of the
graphic in a way that doesn't break.

Something like:

../images/pic1.jpg

obviously doesn't work if the page is a folder or two lower, and

/images/pic1.jpg

doesn't work if the site is installed in a sub-folder on the web server.

Is there some server-side tag that I can use in the path that will work like:

{site-root}/images/pic1.jpg

so that regardless of where the referencing page is located in the hierarchy
and regardless of where the site is installed, it will work???

Thanks
Nov 18 '05 #1
2 1232
using the tilde ~ character might be just what you need..

here's an article about it..

http://www.awprofessional.com/articl...01145&seqNum=2
Nov 18 '05 #2
Julie wrote:

I have a need for a site-absolute path specifier (server side).

My issue is that I have pages w/ graphics in the banners (whee!), but the pages
are at different levels of the folder hierarchy. Lastly, the entire site may
or may *not* be at the website root, it all depends on how it was installed.

So, to reference the graphics, I need a way to specify the location of the
graphic in a way that doesn't break.

Something like:

../images/pic1.jpg

obviously doesn't work if the page is a folder or two lower, and

/images/pic1.jpg

doesn't work if the site is installed in a sub-folder on the web server.

Is there some server-side tag that I can use in the path that will work like:

{site-root}/images/pic1.jpg

so that regardless of where the referencing page is located in the hierarchy
and regardless of where the site is installed, it will work???

Thanks


I guess I'm the only one that has ever had this problem? Regardless, I've
found a solution using the Application object:

ImageUrl = Application["AppPath"] + "/images/pic1.jpg"
Nov 18 '05 #3

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

Similar topics

6
by: David Siroky | last post by:
Hi! When I "compile" my python files with "python -OO ...." into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? ...
2
by: engwar1 | last post by:
I'm a .NET newbie and am beginning the process of converting an existing personal website to .NET from classic ASP. I'm assuming I want my aspx files in the root of my site in the same place as...
7
by: Rizaan Jappie | last post by:
is it possible to get the relative path based on a absolute path in c#? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
0
by: Jason Lawrence | last post by:
I have an attributed ATL project (call it B) that I am building with Microsoft Visual C++ .NET (55537-640-3684941- 18356). In the project I include the COM generated file A.h (from another ATL...
0
by: Chris Gill | last post by:
I'm trying to use cookieless sessions in asp.net using the InProc mode (for various reasons it is not desirable for us to use the other modes if it is possible to avoid them). My problem revolves...
3
by: JeffDotNet | last post by:
I wrote a small data processing application that writes a summary of several hundred files. I use drag and drop on a panel (Panel1) to grab the absolute path to each of these files. Then I begin...
19
by: Jerry M. Gartner | last post by:
Greetings: What is the best way to resolve paths within a document regardless of what path it is opened under? For example: I have x.php and it contains <img src="images...">, (amongst other...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
3
by: buzz2050 | last post by:
Hi all, I am using cURL for the first time. I need to login to a site and my cURL code to do the same is as follows: //curlScript.php <?php function getContent($url, $referer,...
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: 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
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
jinu1996
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.