getting a path to a resource

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

let's I have an image in this directory

/myVirtualDir/images/arrow.gif

let's says this image is used in a common, InfoBox.ascx control which is
used in many pages, let says in

/myVirtualDir/Default.aspx
&
/myVirtualDir/someSubDir/APage.aspx

How could I set the path (href) to this image, so that it work on both
pages?

Curently I use a home made function which is more or less like that
string GetAppPath(HttpContext ctxt, sring path)
{
string app = ctxt.Request.ApplicationPath;
return Path.Combine(app, path);
}

My question is:
I assume that there is probably a function doing that work which I could
use, no?
which one?
 
my problem is ....
what if I change the virtual dir name ?
or what if it's my root application ?
(as in www.myhost.com instead of www.myhost.com/myvirtualdir ?!)

because I write it on my computer in a virtual directory, but I plan to make
it my web page (root, no virtual dir!) and I might moveit around (other
virtual dir, different name) but I still like it to work!

Anyway I guess I have to stick with my solution which is not that complex
anyway....
 
~ !!!!

that's it!!!
big thanks !!!

it's the interest of the <head runat=server> btw, hey!
 
Back
Top