Control.ResolveUrl versus Control.ResolveClientUrl versus VirtualPathUtility.ToAbsolute

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?

Asked on April 7, 2016 in .NET,   ASP.NET.
Add Comment
1 Answer(s)

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:

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.

Answered on April 7, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.