.net - 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 The URL relative to depends on the current address.
For example: if I am at www.foo.com/A/B/C/D.aspx
and www.foo.com/A
is the root path including the virtual directory, then the current code is the path of the ~ / Resources / R1.png
of ./../../ processing / R 1.png
How do I get this relative path?
Edit:
I want a web path that I can use in a web page, not a server path.
ResolveUrl ("~ / Resources / R1.png")
~ 'Is used to represent the root of the application in which the current page / control sits.
Or if the resource is outside the current application but is still found within the virtual directory hierarchy, you can use ResolveUrl ("/ resource / R1.png")
< / Div>
Comments
Post a Comment