getting a path to a resource

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?
 
L

Lloyd Dupont

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....
 
L

Lloyd Dupont

~ !!!!

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top