If you are checking in code behind, See example code below, which works fine as custom code.
var textToSave = XCMFunctions.ProcessCheckAllBadWords(textToCheck);
public static string ProcessCheckAllBadWords(string textstring)
{
// Hashtable that will contain found bad words
Hashtable foundWords = new Hashtable();
// Modify the string according to found bad words and return which action should be performed
BadWordActionEnum action = BadWordInfoProvider.CheckAllBadWords(null, SiteContext.CurrentSiteName, ref textstring, foundWords);
if (foundWords.Count != 0)
{
switch (action)
{
case BadWordActionEnum.Deny:
// Some additional actions performed here ...
break;
case BadWordActionEnum.RequestModeration:
// Some additional actions performed here ...
break;
case BadWordActionEnum.Remove:
// Some additional actions performed here ...
break;
case BadWordActionEnum.Replace:
// Some additional actions performed here ...
break;
case BadWordActionEnum.ReportAbuse:
// Some additional actions performed here ...
break;
case BadWordActionEnum.None:
// Some additional actions performed here ...
break;
}
return textstring;
}
return textstring;
}