惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - rangeliu

批判下微软的sql面试题 SQL Server 报表系统导出txt格式方法 Reporting Service报表纵向单元格合并 SSAS中命名集(SET)的使用 返回指定成员所有下级成员的MDX语句 MDX学习——初始MDX [收藏]Oracle 性能优化 [收藏]使用XML技術實現OWC對數據庫的展示 十六進制的字符串轉換為double類型 [收藏]递归算出两个数字之间所有数字之和 [收藏]String与string的区别 [收藏]about协议的妙用 [收藏]中英文颜色对照表 [收藏]C# WinForm程序如何与JS交互 [收藏]在C#程序中使用系统热键 [转载]动态调用WebService(C#) [转载] .NET脏字过滤算法 [转载]asp.net面试集合 [转载]WEB开发碰到的问题及经验十八则
[转载]使用Response.Filter过滤非法词汇
rangeliu · 2009-01-24 · via 博客园 - rangeliu

 本文章来源:http://blog.csdn.net/hhxxcj/archive/2009/01/20/3844164.aspx

一般信息发布网站,论坛等均具有实现非法词汇过滤功能,即当用户录入非法词汇时,进行替换,使其无法显示到页面上,针对此种功能,通常采用的时,在读取时,在读到非法词汇后,进行替换。这样做的好处是不用将非法词汇存入数据库,缺点是要在每次读取时都要进行替换。另一种解决方案是在输出时过滤掉非常词汇,优点是只要写一次就好了,可以过滤整站的非法词汇,缺点是,非法词汇仍然存入到了数据库中,呵呵,大家可以有针对性的选择,本例用的是后者,起因在于当初没有做此功能,后来需要添加,这时又不想改原来代码,所以就想了这个办法,主要是采用了HttpResponse.Filter属性来处理。具体代码如下:

首先自定义一个类,来作为非法词汇的过滤器

Code


然后再Global.asax文件中,添加如下代码:

Code

或者重写某页的Render方法

Code