How to determine the path of the current web site
- by Velika2
I wanted to create a function which would return the path of the current web site. This is what I thought was working while running in the IDE:
Public Shared Function WebsiteAbsoluteBaseUrl() As String
Dim RequestObject As System.Web.HttpRequest = HttpContext.Current.Request
Return "http://" & RequestObject.Url.Host & ":" & _
RequestObject.Url.Port & "/" & _
RequestObject.Url.Segments(1)
End Function
Does this seem like it should work? Is there a more straight forward way?