Q:

What is the best way to get a path relative to the current address?

Suppose I have a resource located in ~/Resources/R1.png
This resource's relative URL will vary depending on the current address.
For instance:
If I'm at www.foo.com/A/B/C/D.aspx and the www.foo.com/A is the root path including Virtual Directory, then the path relative to the current address of ~/Resources/R1.png is ../../../Resources/R1.png
How can I get this relative path?
EDIT:
I want a web path that I can use in a web page, not a server path.

A:

ResolveUrl("~/Resources/R1.png")
Where '~' is used to represent the root of the application in which the current page/control sits.
Or if the resource is external to the current application but is still found within the virtual directory hierarchy, you can use ResolveUrl("/Resources/R1.png")

