You can use the CleanInput method defined in this example to strip potentially harmful characters that have been entered into a text field that accepts user input. In this case, CleanInput strips out all non-alphanumeric characters except periods (.), at symbols (@), and hyphens (-), and returns the remaining string….