This topic is locked

How to Set Image Src in Custom Script

3/20/2016 3:20:32 PM
ASPRunner.NET General questions
R
raymueller authorDevClub member

I created a website using IIS in the default wwwroot directory. The application alias is CHIN whose physical directory is C:\inetpub\wwwroot\chin.
The default starting page is a list page where the custom code was set to display an image using the following code.
if (value=="INCREASING")

value="<img src='../images/green36.png'>";

else if (value=="HOLDING")

value="<img src='../images/yellow36.png'>";

else

value="<img src='../images/red36.png'>";
Since moving the application from using the internal web server to IIS, the images are not displaying.
The images are loaded to the Images directory.
WHen I right-click on the image not displayed on the web page and request to view the image, it states that the image URL is https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=23746&image=1&table=forumtopics and that the file location of the image is C:\inetpub\wwwroot\images\ArrowGreenS.png
If I enter the URL https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=23746&image=2&table=forumtopics which works.
How do I set the image src so I can use a relative address that includes the site name in the URL?

jadachDevClub member 4/7/2016

Did you try /image/green36.png ?

A
Arkie 4/8/2016

I'm not quite sure how you're placing these images, but here's a possibility. You might be able to use the "Filter As" on a value in the list. This would change the color of the value itself rather than a separate image.
Here's another thought that I don't know if it will work in your case or not. When I get to the point of having a ready-to-publish version on my development system, I publish to a directory on the development system that's named the same as the final resting place on the server. My data directory is about 2 layers about the application so I can simply copy everything to the server and all the pathways match up.
I think in order for this to work in your case, the question becomes: Will your code work if you give the image the entire path? i.e. "c:\dir1\dir2\images\green36.png"