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

推荐订阅源

有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
博客园 - 【当耐特】
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
B
Blog RSS Feed
腾讯CDC
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
The Cloudflare Blog
V
V2EX
S
SegmentFault 最新的问题

博客园 - Seraph

共享源码 统计多个word文件中的总字数 聚类算法DBScan共享 惭愧啊,居然两年没有写Blog了。翻看从前的东西恍惚隔世 DNN WebMail Module 开发 —— 第一篇 SharpWebMail 调试篇 开始研究DNN了。发现自己落伍了很多 在 ASP.NET 中执行 URL 重写(zz) XML转义 C#中的多線程 ASP 字符串函数 C# escape sequence - Seraph C#字符串的使用笔记 关于一个算法,看看大家有没有好办法。 写了一个进制转换的小函数,javascript的 发现好久没有写随笔了。 都是一些小东西(1)一个InputBox 谁知道怎么对一个asp.net的project加注册 天子呼来不上船,自称臣是酒中仙——我的嗜酒情节 两篇文章都是翻译了一半就翻不下去了,E文水平有待提高啊 Scott Watermasysk承诺的文档到现在还没有Release,sigh
Request Validation - 防止脚本攻击
Seraph · 2005-07-08 · via 博客园 - Seraph

A new ASP.NET version 1.1 feature, request validation, prevents the server from accepting content containing un-encoded HTML. This feature is designed to help prevent some script-injection attacks whereby client script code or HTML can be unknowingly submitted to a server, stored, and then presented to other users. We still strongly recommend that you validate all input data and HTML encode it when appropriate.

Request Validation 是ASP.NET 1.1的新特征,它可以禁止服务器接受含有未编码的HTML的内容。这个特征可以有效地保护服务器免受注入式脚本攻击。强烈建议验证所有的输入数据和HTML编码。
For example, you create a Web page that requests a user’s e-mail address and then stores that e-mail address in a database. If the user enters <SCRIPT>alert(“hello from script”)</SCRIPT> instead of a valid e-mail address, when that data is presented, this script can be executed if the content was not properly encoded. The new request validation feature of ASP.NET 1.1 prevents this from happening.
例如,你需要创建一个获取和存储用户email的网页。如果用于写入<SCRIPT>alert(“hello from script”)</SCRIPT>这样子的话,就会出问题。(啥问题我就不说了,hoho)

嗯,1.1直接就把这些过虑了,呵呵。出错信息就是potentially dangerous Request.Form value was detected...

<%@ Page validateRequest="false"  %>

Caution: When request validation is disabled, content can be submitted to a page; it is the responsibility of the page developer to ensure that content is properly encoded or processed.

Disabling request validation for your application
To disable request validation for your application, you must modify or create a Web.config file for your application and set the validateRequest attribute of the <PAGES /> section to false:

<configuration>
  <system.web>
    <pages validateRequest="false" />
  </system.web>
</configuration>

这样可以关闭这个功能。

或者嘛,就是encoder好了