Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:39:16+00:00 2026-05-28T20:39:16+00:00

Here is my Default.aspx <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default ValidateRequest=false %> <html> <head

  • 0

Here is my 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>
            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>

And below is 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 I run the application and enter following in the text box.

<script>alert('Hello')</script>

I get following error.

A potentially dangerous Request.Form value was detected from the
client (txtFeedback=”alert(‘Hello…”).

My question is why I get this error even though ValidateRequest is set to false in the page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:39:16+00:00Added an answer on May 28, 2026 at 8:39 pm

    In .net framework 4.0 you have to set <httpRuntime requestValidationMode="2.0"/> markup in web.config.

    <system.web>
         <compilation debug="false" targetFramework="4.0" />
         <httpRuntime requestValidationMode="2.0"/>
    </system.web>
    

    Have a look at reference article – ASP.NET 4 Breaking Changes #1: requestValidationMode cause ValidateRequest=False to fail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=WebClient._Default %> <!DOCTYPE html PUBLIC
<%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default %> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
Here is the full code: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default2.aspx.cs Inherits=Default2 %> <!DOCTYPE html
I have a simple page per below: Default.aspx <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default
<%@ Page Language=C# AutoEventWireup=true CodeFile=Default3.aspx.cs Inherits=Default3 %> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
I have the following webform: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=TestWebApp.Default %> <!DOCTYPE html
I have the following which works fine: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default2.aspx.cs Inherits=test_library_newsletter_Default2 %>
Scenario : Default.aspx is as below. <%@ Page MasterPageFile=~/StandardLayout.master Language=C# CodeFile=Default.aspx.cs Inherits=_Default %> <%@
On the base.master: <%@ Master Language=C# AutoEventWireup=true CodeBehind=Base.master.cs Inherits=WebApplicationControlTest.Base %> <!DOCTYPE html PUBLIC -//W3C//DTD
Here is my code <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=<%= ResolveUrl(Scripts/jquery-1.3.2.min.js) %>></script>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.