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 4597648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:17:13+00:00 2026-05-21T23:17:13+00:00

When I try to post any thing that contains <whatever> I get A potentially

  • 0

When I try to post any thing that contains <whatever> I get

A potentially dangerous Request.Form
value was detected from the client
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. To allow pages to
override application request
validation settings, set the
requestValidationMode attribute in the
httpRuntime configuration section to
requestValidationMode=”2.0″. Example:
. After
setting this value, you can then
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. For more
information, see
http://go.microsoft.com/fwlink/?LinkId=153133.

Exception Details:
System.Web.HttpRequestValidationException:
A potentially dangerous Request.Form
value was detected from the client

I have following asp.net code

 <asp:DetailsView ID="newsDetail" runat="server" DataSourceID="SqlDataSourceNews"
                AutoGenerateRows="False" DataKeyNames="id" 
                OnItemUpdating="NewsDetailItemUpdating" OnItemCreated="NewsDetailItemCreated"
                OnItemDeleted="NewsDetailItemDeleted" OnItemInserted="NewsDetailItemInserted"
                OnItemInserting="NewsDetailItemInserting" OnItemUpdated="NewsDetailItemUpdated"
                DefaultMode="Insert">

                <Fields>
                    <asp:TemplateField FooterText="show at statpage" HeaderText="view" SortExpression="view">
                       ...
                    </asp:TemplateField>
                    <asp:BoundField DataField="headline" HeaderText="Headline" SortExpression="headline">
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Text">
                        <ItemTemplate>
                            <asp:Label ID="post" runat="Server" Text='<%# Eval("post") %>' OnPreRender="PostLabelPreRender" />
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="postTextBox" runat="server" Text='<%# Bind("post") %>' TextMode="MultiLine"
                                Width="500px" Height="300px" />
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="postTextBox" runat="server" Text='<%# Bind("post") %>' TextMode="MultiLine"
                                Width="500px" Height="300px" />
                        </EditItemTemplate>
                    </asp:TemplateField>

And the code

    protected void NewsDetailItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        // Iterate though the values entered by the user and HTML encode 
        // the values. This helps prevent malicious values from being 
        // stored in the data source.
        for (int i = 0; i < e.NewValues.Count; i++)
            if (e.NewValues[i] != null)
                e.NewValues[i] = Server.HtmlEncode(e.NewValues[i].ToString());
    }

    protected void NewsDetailItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        for (int i = 0; i < e.Values.Count; i++)
            if (e.Values[i] != null)
                e.Values[i] = Server.HtmlEncode(e.Values[i].ToString());
    }

    protected void NewsDetailItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        newsList.DataBind();
    }

    protected void NewsDetailItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        newsList.DataBind();
    }

    protected void NewsDetailItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
        newsList.DataBind();
    }

    protected void NewsDetailItemCreated(object sender, EventArgs e)
    {
        newsList.DataBind();
    }
  • 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-21T23:17:14+00:00Added an answer on May 21, 2026 at 11:17 pm

    The problem you’re having is that in one of your text boxes you have put html tags or just the < > symbols and the .net framework tracks that as a potential dangerous script. This is to prevent people from putting malicious script tags in the input fields.

    You can work around this by putting in your page directive ValidateRequest="false" you will also have to put in your web.config <httpRuntime requestValidationMode="2.0" ... />

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

Sidebar

Related Questions

HttpRequestValidationException occurs when I try post when txtBulletin contains any HTML, like Hello<br />World
i try to post data by ajax , it gives me name value bu
I try to perform a simple POST-request with urllib2. However the servers response indicates
When I try to convert an HTTP POST response to JSONArray I get the
I try to make a registration form. When user post the fields, i check
When I try to post this email : name+1@domain.com I get name 1@domain.com in
I have a page in a site that contains an iframe with a form
Iam suffering from Zend_validate ,when ever I write a form and try to add
Every time I try to post to twitter in my rails app, the first
I could try to post and explain the exact query I'm trying to run,

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.