I needed a way to easily convert a relative URL to an absolute URL for a link within a project I’m currently working on. I imagined I’d have to roll something myself and was starting to think it would have to be pretty complex… then .net suprised me 😉
Public Function GetAbsoluteUrl(ByVal currUrl As String, _ ByVal relUrl As String) As String Dim baseUrl As New Uri(currUrl) Dim destUrl As New Uri(baseUrl, relUrl) Return destUrl.AbsoluteUri End Function
Now that is nifty 🙂
Leave a Reply