Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative image/css path not working

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
In my app pages I have image path like
images/Interactive_logo.gif

the pages are located on c:\inetpub\ and runs on asp 2005 default web server, which is .net web server, not IIS

In my source of the page I see this as image source
The problem is that image is not showing and I do have images folder in C:\inetpub\ folder with all the correct images. What could be causing for images not to show?
I even tried putting images folder one level up to folder, still no luck

thanks
 
One of my Tutorials say if you are having that problem to insert runat="Server" into the img tag.

90% of all questions can be answer by the Help file! Try it and be amazed.
 
well, thanks, but can you elaborate why this would help and what the issue is? I am working on an existing site and cannto just insert that for all images on all pages since it worked without it for other people. It must be somethign with my folder structure

 
The book I am using is a "Dummies" book, so the technical explanations are few and far between. I had the same problem, tried the recommended solution, it worked. Viola! Figure it out later when I got time. Similar problem, made suggestion, up to you whether you want to try it or not.

To start off, I am operating on a few assumptions here:

1. Your project folder is c:\inetpub\
2. You are using ASP.Net pages, since that is what this forum's subject matter is about.

3. You are aware that any base address that startsd with " is going to be physically located on your computer, not at a remote website.

4. All the images you are referencing are physically located on your hard drive in the specified folder.

Now if all those assumptions are correct, the only thing I can say is that the files on the remote server may not be ASP.net pages, but rather HTML pages, which function subtly different than asp pages. If my understanding of ASP.net is correct, Asp pages are instructions to the server which it uses to create html pages, which are then sent to requesting computer.


90% of all questions can be answer by the Help file! Try it and be amazed.
 
Adding runat="server" will not make your images appear as this simply creates a reference so that the element can be referenced from your code behind page. However, this could be used in conjunction with a tilde sign (~) which will reference the base folder of your application. So, if you add runat="server" to an img element and add the path like this:
Code:
<img id="myImage" runat="server" src="~/images/image.jpg" alt="my image"/>
Then when the ASP.NET page loads, it will look for the root path and append it to the src, therefore rendering something like:
Code:
<img id="myImage"  src="[URL unfurl="true"]http://localhost:3030/website1/images/image.jpg"[/URL] alt="my image"/>

However, I don't actually think this is your problem. If you really have put a relative path in your image then it wouldn't render a absolute path like you claim it has (unless it is a server-side control which you haven't mentioned).

Try browsing directly to the path Does that show the image?


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top