Ecco il mio Default.aspxerrore di richiesta perché potenzialmente pericoloso anche ValidateRequest = false
<%@ 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>
We are looking for your 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>
E sotto è 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;
}
}
Quando eseguo l'applicazione ed entro segue nella casella di testo.
<script>alert('Hello')</script>
Viene visualizzato errore.
Un valore potenzialmente pericoloso Request.Form è stato rilevato dal client (txtFeedback = "alert ('Ciao ...").
mia domanda è perché ottengo questo errore anche se ValidateRequest è impostato su false nella pagina?
questo è stato. Grazie –