易截截图软件、单文件、免安装、纯绿色、仅160KB

关于ASP.Net的validateRequest=false(验证请求)

ASP.Net的validateRequest=false
      validateRequest="false"   指是否要IIS验证页面提交的非法字符,比如:>,<号等,当我们需要将一定格式得html代码获得,插入数据库时候,就要将这个属性设置为false,例如你将字体加粗等操作时。
   
ASP.Net 1.1后引入了对提交表单自动检查是否存在XSS(跨站脚本攻击)的能力。当用户试图用之类的输入影响页面返回结果的时候,ASP.Net的引擎会引发一个 HttpRequestValidationExceptioin。默认情况下会返回如下文字的页面:
以下是引用片段:
Server Error in '/YourApplicationPath' Application
A potentially dangerous Request.Form value was detected from the client
(txtName="<b>").
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.
Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (txtName="<b>").
....
  这是ASP.Net提供的一个很重要的安全特性。因为很多程序员对安全没有概念,甚至都不知道XSS这种攻击的存在,知道主动去防护的就更少了。ASP.Net在这一点上做到默认安全。这样让对安全不是很了解的程序员依旧可以写出有一定安全防护能力的网站。
  但是,当我Google搜索 HttpRequestValidationException 或者 "A potentially dangerous Request.Form value was detected from the client"的时候,惊奇的发现大部分人给出的解决方案竟然是在ASP.Net页面描述中通过设置 validateRequest=false 来禁用这个特性,而不去关心那个程序员的网站是否真的不需要这个特性。看得我这叫一个胆战心惊。安全意识应该时时刻刻在每一个程序员的心里,不管你对安全的概念了解多少,一个主动的意识在脑子里,你的站点就会安全很多。
  为什么很多程序员想要禁止


相关文档:

Explained: Forms Authentication in ASP.NET 2.0

原地址:
http://msdn.microsoft.com/en-us/library/aa480476.aspx
IIS Authentication
ASP.NET authentication is a two-step process. First, Internet Information Services (IIS) authenticates the user and creates a Windows token to represent the user. IIS determines the authentication mode that it shoul ......

asp.net mvc ajax 外部js 异步递交 form的实现

页面文件类似:
<% using (Ajax.BeginForm("AjaxUpdate", 123, new AjaxOptions {
Confirm = "confirm str", LoadingElementId = "idLoading", UpdateTargetId
= "textEntered", OnSuccess = "validateForm" },new{id="idMyForm"}))
  &nbs ......

ASP.NET中将数据输出到Excel

在开发ISO文件管理系统的时候,曾经遇到过要将ASPX直接输出到EXCEL的需求,现将经验所得与大家分享。 其实,利用ASP.NET输出指定内容的WORD、EXCEL、TXT、HTM等类型的文档很容易的。主要分为三步来完成。
  一、定义文档类型、字符编码
Response.Clear(); 
Response.Buffer= true; 
Response ......

Asp.Net中gridview中嵌入的checkbox使用

<asp:checkbox id = "checkbox1" runat = "server" AutoPostBack = "true" OnCheckedChanged = "CheckAllBox_Checked" text = "全选">
<asp:CheckBox  ID = "CheckBox1" AutoPostBack = "true" OnCheckedChanged = "CheckBox1_Checked" runat = "server"/>
 protected void CheckBox1_Checked(obj ......

让你的ASP.NET虚拟主机也支持子网站

  现在ASP.NET虚拟主机一般都可以绑定多个域名,但是通过这几个域名打开的页面都一样。如何使绑的这几个域名分别打开不通的页面(即实现子网站的功能)呢? 其实很简单,只需4个步骤:
    1)给虚拟主机绑定几个域名;例如:www.abc.com,services.abc.com,support.abc.com。
    2 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号