Solved

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

Posted on 2013-06-17
4
516 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now