views:

36

answers:

1

I have been working in an MVC project, and have seen both of these used. I was wondering what the difference between them is? Is it incorrect to use one over the other? My understanding is that I should be using Url.Content(), but VirtualPathUtility.ToAbsolute() seems to be working as well.

+1  A: 

Url.Content() is an utility method part of MVC. Being there to uniformize and centralize utility classes I guess.

VirtualPathUtility.ToAbsolute() is a .NET Framework method. Maybe the MVC one is using it, we would have to check the source...

Hope the helps

Mike Gleason jr Couturier
Url.Content() eventually calls VirtualPathUtility but it does quite a bit more. I'd edit your answer but I'd need to post buckets full of code. ;)
jfar
Thanks for clarifications jfar!
Mike Gleason jr Couturier