SPUtility.GetUrlDirectory Method
Returns the directory-path part of the URL.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Shared Function GetUrlDirectory ( _
url As String _
) As String
'Usage
Dim url As String
Dim returnValue As String
returnValue = SPUtility.GetUrlDirectory(url)
public static string GetUrlDirectory(
string url
)
Parameters
url
Type: System.StringThe URL path.
Return Value
Type: System.String
A string that contains the directory path of the URL.
Remarks
If the url parameter is https://server/web/list/folder/file.txt, the returned directory part is "https://server/web/list/folder".