Solved

ASP.NET - A potentially dangerous Request.Form value was detected from the client

Posted on 2013-06-17
4
527 Views
Last Modified: 2013-07-15
I am using a LinkButton.  When the user clicks on the LinkButton the above error occurs.  Any way to avoid the error?  I can't put pagevalidation = false.

<asp:LinkButton ID="lnkDownloadDoc" runat="server" 
      ImageID='<%#DataBinder.Eval(Container, "dataItem.imageId")%>'
      OnClick="lnkDownloadImage_Click" >
      <%#DataBinder.Eval(Container, "dataItem.imageId")%>
</asp:LinkButton>

Open in new window


Thanks
0
Comment
Question by:CipherIS
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39254804
Could you send the contents of "DataBinder.Eval(Container, "dataItem.imageId")"?

Any way, the link button control values cannot contain the following characters: "<", ">", etc. as explained in the link below:
http://www.dreamincode.net/forums/topic/234664-potentially-dangerous-requestform-value-was-detected-from-the-client/

Possible solutions:
1) Disable validation, check:
http://stackoverflow.com/questions/9130186/a-potentially-dangerous-request-form-value-was-detected-from-the-client
2) Avoid using these characters on your html markup. Encoding (HtmlEncode) may not work because you are using these characters at ImageID.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 39256750
I've attached a copy of the data being passed.  I am using a repeater.  In the repeater I have a LinkButton.  The linkbutton is useing column imageStoreID.  That field is the one causing the error.  It does not make sense why that would be the issue.  

Any ideas?
DocIDIssue.jpg
0
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39257945
The data looks good, thus the link control is not the problem here, you have these characters elsewhere in the page that are being transmitted as part of the post back request, please post markup/code of the whole page, (e.g. lnkDownloadImage_Click)
The way I will go about it is I will start removing markup element until you find the culprit control markup causing this issue. Antoher way is to create just a new page with the repeater and the link button and see if you still have the same error.
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 500 total points
ID: 39265379
hi. you have to set this value on .aspx page first line

<%@ Page Language="VB" AutoEventWireup="false" CodeFile=".vb" EnableEventValidation="false" ValidateRequest=true  Inherits="PageName" %>

If it is not solved please try to change true/false.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question