Re: Can't Access Image Above Project Root



On Mon, 25 Feb 2008 17:54:26 +0100, pbd22 <dushkin@xxxxxxxxx> wrote:

Thanks Rik.

Well, I think the idea is to use "relative paths".

Well, duh.

The browser is an
application that will be loaded on several servers at various
locations so, its better to do something like "../path/to/image.jpg"
than use a URL or and IP which changes from box to box.

Yes, but if a page is http://project.example.com/index.html, having a relative URL like '../images/foo.jpg' doesn't do you any good, as allthough it may seem a valid path on the server, a browser doesn't request relative urls from the server, it translates them and uses a fully qualified url. In the example, there is no path above http://project.example.com... Would you have had http://www.example.com/foo/bar.html, with a src attribute like '../images/foz.jpg', the browser requests 'http://www.example.com/images/foz.jpg', NOT '../images/foz.jpg'.

What's the URL of the actual page you are watching?

So, havening said that, the URL (not public) is http://www.domain.com/presentation.aspx

example.com is reserved for those purposes. Here, from s browsers point of view, there is clearly no path above it.

And, inside presentation.aspx is an iframe that has src=slides.htm.
Inside slides.html is the image tag that looks for an image in a
sibling folder to the root folder.

url should be a valid 'path' considered from the browsers point of view, NOT the servers.

I think I am doing that correctly. And, as far as i understand, the
below image:

<img src="../folder/image.jpg" alt="img" />

should expose an image in a folder named "folder" that is a sibling to
the web site's root folder.

Nope, you can't go outside the root folder (you can offcourse serve files outside the root folder using some scripts on the server, that's beside the point though), the browser MUST have a 'reachable' destination. The browser doesn't know lick about your filesystem, and can't examine it. Having the path 'http://www.example.com/', there's no logical way a browser can select a directory above that, or even guess at how to access it.
--
Rik Wasmus
.



Relevant Pages

  • Re: Website Images Broken
    ... message the browser displays. ... Yes, ASPNET account has "Full Control" on the root folder, as well as the ... some images of my ASP.NET website are cannot be ... displayed in the browser (even tho they exists on the server). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Does NOT launch text editor
    ... Check your share permissions on the root folder of the server. ... > I have written an HTML page that is emailed to end-users. ... it opens the file in the browser window. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Connection string for ASP.NET or ASP
    ... I have created olap.asp under my root folder (under 'justin' folder). ... Dim MyCon as ADODB.Connection ... SSPI=Kerberos is required when the web server and the OLAP server are on 2 ...
    (microsoft.public.sqlserver.olap)
  • sharepoint services 3.0 root folder
    ... I'm trying to install sharepoint services 3.0 on a server with the ... - anonymous access site running asp .net ... What I would like to have at the root folder is a simple web page and ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Releasing to the development server
    ... Don't worry, ... Since its a server machine, I suggest that you create another test site ... and copy the webctrl_client dir under that site's root folder and create a ...
    (microsoft.public.dotnet.framework.aspnet)