How can I restrict any special characters entered in the textbox?
I have a textbox where the user can enter in the textbox to validate if the url exists in the db. Before I hit the db I want to make sure there is no special characters entered in the textbox
for an example if some user try to enter something like:
)(*&<>&*^&*^&*$%#!@#$http://www.cnn.com!@#$%^&*()
Before they paste or type the url with special characters how can I not allowed in the textbox?
The only expection to this is: & (ampersand) is allowed if it is in between the url something like this:
http://cnn.com/news/latest.html&id=1
The simplest answer is to just make a method to strip characters on the client side.
You make a similar method on your server (just in case the client doesnt have javascript or defeats the script).