PDA

View Full Version : Problem displaying images..


jevans
04-27-2004, 03:38 AM
I am haveing a problem displaying images on my DASP site. I store the graphic files in a subdir \Images and then in code I bind the image controls to the files like this.

img1.ImageUrl = context.Request.ApplicationPath & "/Images/image1.gif"

This works fine in my dev environment - but I get the red x on DASP.

Any help???

Thanks


J. Evans

Scott
04-27-2004, 05:25 AM
Try replacing <u>context.Request.ApplicationPath</u> with <u>Server.MapPath("")</u>.

jevans
04-28-2004, 04:08 AM
Sory -

I forgot to mention in the first post that I had tried Server.MapPath also. Both of these approaches work in my dev environment - neither work in the DASP environment. They are not resolving the path to the file location correctly when I show properties on the image control at runtime. Could it be that I need to do some setup on the Images folder with IIS Mgr?? IIS is not one of my strong points.

J. Evans

steurm
04-28-2004, 11:56 AM
Can you give the url which is in the html source of your page and also the url which it would need to be ? We might find the answer in here.

--
Steurm
www.steurm.net/steurm

jevans
04-29-2004, 04:30 AM
Well....

Actually, to get my site looking somewhat professional, I moved all the graphics file into the home folder and just used:

img1.ImageUrl = "image1.gif"

This does work. I have done a complete new version of my website - all new look. This is the one that depends on the subfolders. I can't move it up to production untill I resolve this.

I'll try and put something in the current production version to demonstrate the issue.

I noticed on your site that you are using the same stratigy - a subfolder for the images - how are you resolving the path to the image files?

J. Evans

Packman
07-16-2004, 01:14 AM
OK.

Image1.ImageUrl = "pics/2004.jpg";

This works both on my local machine and on the DASP server.

Thanks

Todd Thigpen
Webmaster

Packman
07-16-2004, 11:57 AM
I am having the same problem.

string Path = Server.MapPath("");
Image1.ImageUrl = Path + "\\pics\\2004.jpg";

This code works great on my local machine, but not on the DASP Site.

I need to organize my images in directories. The solution to put them in my root is not acceptable.

Todd Thigpen
Webmaster

bruce
07-16-2004, 12:09 PM
server.mappath gives your the physical path (e:\web\something\htdocs) to the file.

ImageURL is looking for the URL, eg. http://www.yourdomain.com/pics/2004.jpg

It will work on your local machine because the physical path can also bring up the image.


[b]quote:Originally posted by Packman

I am having the same problem.

string Path = Server.MapPath("");
Image1.ImageUrl = Path + "\\pics\\2004.jpg";

This code works great on my local machine, but not on the DASP Site.

I need to organize my images in directories. The solution to put them in my root is not acceptable.

Todd Thigpen
Webmaster
</blockquote id="quote"></font id="quote">