public static string HtmlUrlAttributeEncode(string urlAttributeToEncode) { if (urlAttributeToEncode != null && urlAttributeToEncode.Length != 0) { if (!SPUrlUtility.IsProtocolAllowed(urlAttributeToEncode)) { return(string.Empty); } return(SPHttpUtility.HtmlEncode(urlAttributeToEncode)); } return(urlAttributeToEncode); }
public static bool IsProtocolAllowed(string fullOrRelativeUrl) { return(SPUrlUtility.IsProtocolAllowed(fullOrRelativeUrl, true)); }