views:

20

answers:

1

So, I have a function:

public string genSomeHtml(){
   //Gen some html including and image called foobar.gif
}

Now, I want to call genSomeHtml() from two different pages, but they have different paths to /images. So, I can't exactly use "../../images/foobar.gif" and I'd rather not pass a param to tell me where to look. Afterall, the calling page shouldn't care about how the html is rendered, it just needs to work.

any ideas?

+1  A: 

General answer: Output your image with an absolute uri, instead of relative. so <img src="images/myphoto.jpg"> becomes <img src="http://localhost/images/myphoto.jpg"&gt;

If that wasn't the right answer, please rephrase your question and add examples.

tilman
While this would have worked, it wasn't the exact solution I went with. I will accept though, as it is technically a correct answer.
IniTech