If you're in the context of an MVC Controller or View you can use the UrlHelper which should be accessible via just Url
Url.Content("~/content/images/myimage.jpg")
Which will be fully expanded to /virtual_directoryname/content/images/myimage.jpg
This can be used in a controller or .cshtml file
Yes it is a little odd that it's called Content
but it's meant to be used to get an absolute path to a resource so it makes sense