Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control.ResolveUrl versus Control.ResolveClientUrl versus VirtualPathUtility.ToAbsolute

Tags:

Is there any benifit to using one of these methods over the other when resolving paths which start with the tilde (~)?

Generally, what is a better practice, should you be sending relative paths or absolute paths down in your html?

like image 980
Bob Avatar asked Feb 05 '09 22:02

Bob


1 Answers

The difference between ResolveUrl and ResolveClientUrl is that ResolveClientUrl returns a path relative to the current page, ResolveUrl returns a path relative to the site root:

http://www.andornot.com/blog/post/ResolveUrl-vs-ResolveClientUrl.aspx

I would recommend using absolute paths.

Edit: Rick Strahl posted a nice article about this

Edit2: Removed bit about caching. Does not add to the answer and may not necessarily be accurate.

http://west-wind.com/weblog/posts/132081.aspx

like image 137
Aaron Hoffman Avatar answered Oct 05 '22 07:10

Aaron Hoffman