我如何HTML恩code在一个Web应用程序的所有输出? [英] How do I HTML Encode all the output in a web application?

查看:106
本文介绍了我如何HTML恩code在一个Web应用程序的所有输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的web应用程序prevent XSS攻击。我发现HTML编码输出可真prevent XSS攻击。现在的问题是,我该怎么办HTML EN code在我的应用程序的每一个输出?我有没有办法来自动完成这个?

I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every single output in my application? I there a way to automate this?

我AP preciate答案为JSP,ASP.net和PHP。

I appreciate answers for JSP, ASP.net and PHP.

推荐答案

您不想EN code所有HTML,您只需要HTML-CN code,你输出任何用户输入。

You don't want to encode all HTML, you only want to HTML-encode any user input that you're outputting.

有关PHP:ヶ辆并的用htmlspecialchars

这篇关于我如何HTML恩code在一个Web应用程序的所有输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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