.net 4.0 - Why potentially dangerous request error even ValidateRequest = false -
.net 4.0 - Why potentially dangerous request error even ValidateRequest = false -
here default.aspx
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" validaterequest="false" %> <html> <head runat="server"> <title>xss demonstration</title> </head> <body> <form id="form1" runat="server"> <div> looking feedback. <asp:textbox id="txtfeedback" runat="server" textmode="multiline" /> <br /> <asp:button id="submit" runat="server" text="submit" onclick="submit_click" /> <br /> comment: <br /> <asp:literal id="ltlfeedback" runat="server" /> </div> </form> </body> </html>
and below default.aspx.cs
public partial class _default : system.web.ui.page { protected void submit_click(object sender, eventargs e) { this.ltlfeedback.text = this.txtfeedback.text; } }
when run application , come in next in text box.
<script>alert('hello')</script>
i next error.
a potentially unsafe request.form value detected client (txtfeedback="alert('hello...").
my question why error though validaterequest set false in page?
in .net framework 4.0 have set <httpruntime requestvalidationmode="2.0"/>
markup in web.config.
<system.web> <compilation debug="false" targetframework="4.0" /> <httpruntime requestvalidationmode="2.0"/> </system.web>
have @ reference article - asp.net 4 breaking changes #1: requestvalidationmode cause validaterequest=false fail.
.net-4.0 asp.net-4.0
Comments
Post a Comment