禁止特殊字符和单词列表 [英] disallow special chracter and list of words

查看:89
本文介绍了禁止特殊字符和单词列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我想知道在asp.net c#Framework 2.0中编写函数(全局)的最佳方法是检查表单中的文本框(我在一个表格上有大约80个文本框,我有很多表格和textarea

我有90个ro 100单词和特殊字符列表,我不希望用户输入。如果他们输入项目从被阻止的单词或字符列表我想给他们错误说不允许这个字符或单词,请更正它

该网站已经获得了很多点击,所以我想确定它不会减慢很多。我想在找到列出的单词或特殊字符之后立即发出消息并且不想继续进一步检查。

$ b $例如,阻止列表字abc,bbc,bbd,cbc,xbc,〜,^,,等。列表可以在将来改变。


我是asp.net的新手,感谢他们得到任何帮助。


谢谢

newcoder

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.

Thanks
newcoder

推荐答案

最简单的方式来到我的大脑正在使用if / else构造函数,你必须提到那些字符和单词。
The simplest way that comes to my mind is using if/else constructor where you have to mention those charaters and words.


我通常有一个Utils。只有一堆公共静态/共享方法的类,可以帮我做日志打印等事情。


我看不出你为何不能使用这样的课程在您的应用程序中进行验证。你可以在应用程序的任何地方调用这些方法。


-Frinny
I typically have a "Utils" class that just has a bunch of public static/shared methods that help me do things like print to a log etc.

I seen no reason why you can''t use such a class in your application to do validation. You can call these methods from anywhere in your application.

-Frinny


你是对的。老实说,我对此非常陌生,我不知道如何正确使用这样的功能。任何帮助编写此函数的帮助都会很棒。


谢谢
your are right. Honestly I am very new to this and I do not know how to right such a function. Any help in sarting to write this function would be great.

Thanks


这篇关于禁止特殊字符和单词列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆