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

I try Request.Form.Set(k, v) but it's throwing exception Collection is read-only
I have a page in a site that contains an iframe with a form
When I try to post this email : name+1@domain.com I get name 1@domain.com in
Recently, I made a post about the developers I'm working with not using try
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
We try to convert from string to Byte[] using the following Java code: String
I try to write KSH script for processing a file consisting of name-value pairs,
I've got a really strange error and any light that anyone can shed on
I have a file that takes a variable from the user then prints something,
I will try to make myself as clear as possible. Let start from the

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.