Hi All,

I would like to know what's the best way to write function(global) in asp.net c# Framework 2.0 to check for textbox in a form (i have about 80 textbox on one form and I have many forms and textarea
and I have list of 90 ro 100 words and special chracter that I do not want user to enter. If they enter the item from the list of blocked word or character I want to give them error saying "this character or word in not allowed, please correct it"
The site is getting many hits already so I want to make sure it's not going to slow down a lot. I want to give the message as soon as one of the word or special character listed is found and not want to continue checking further.

e.g of block list word "abc","bbc","bbd","cbc","xbc","~","^","'". the list can change in the future.

I am new to asp.net and appreciate any help.



you want to restrict some specific words for a specific textbox? for ex, is it like you wanna restrict "abc","pqr","Xxx" for textbox1 & "^","&","#" for textbox10? or the words/chars are fixed for each n every textbox on the form??

you can either go for Regular expression or use client side validator for each text box...

for regular Expression click Here, Here & Here

Thanks I am using regular expression for now but I would like to create function so I can use it for querystring parameters also (just in case)and I want to store that in a class and validate with just passing through the function.