?
Solved

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

Posted on 2013-06-17
4
Medium Priority
?
575 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 36

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 36

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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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