SPUrlUtility.IsProtocolAllowed Method (String, Boolean)
Gets a Boolean value indicating whether the specified URL uses a supported protocol.
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 IsProtocolAllowed ( _
fullOrRelativeUrl As String, _
allowRelativeUrl As Boolean _
) As Boolean
'Usage
Dim fullOrRelativeUrl As String
Dim allowRelativeUrl As Boolean
Dim returnValue As Boolean
returnValue = SPUrlUtility.IsProtocolAllowed(fullOrRelativeUrl, _
allowRelativeUrl)
public static bool IsProtocolAllowed(
string fullOrRelativeUrl,
bool allowRelativeUrl
)
Parameters
fullOrRelativeUrl
Type: System.StringA string that contains the full or relative URL.
allowRelativeUrl
Type: System.Booleantrue to allow a relative URL as the fullOrRelativeUrl parameter; otherwise, false.
Return Value
Type: System.Boolean
true if the URL uses a supported protocol; otherwise, false.
Remarks
To return an array of allowed protocols, use the AllowedProtocols property.