Solved

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

Posted on 2004-08-14
4
768 Views
Last Modified: 2008-03-06
I am trying to send a variable to flash, but it doesn't seem to work, this is an error i keep getting,

A potentially dangerous Request.Form value was detected from the client (number="12 <!DOCTYPE HTML PUBLI...").

i am trying to send the variable number = 12 to flash

this is what i have

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            Response.Write("&number=12")

        End Sub
0
Comment
Question by:dkilby
  • 2
4 Comments
 
LVL 18

Expert Comment

by:tusharashah
ID: 11802640
This is caused by the ValidateRequest attribute of the Page directive. By default it is set to true, which means that ASP.NET
examines all input for potentially dangerous data.

If you set the ValidateRequest to false in your web.config, machine.config or Page directive of your particular page, it should work.

----------------------------------------------
<!--Web.Config -->
<system.web>
     <pages validateRequest="false" />
 </system.web>


----------------------------------------------
//Your Page
<%@ Page language="c#" Codebehind="brandAdd.aspx.cs" AutoEventWireup="false" Inherits="Admin.brandAdd" ValidateRequest="false %>
----------------------------------------------


-tushar
0
 

Author Comment

by:dkilby
ID: 11802770
Tried that and it didn't work
0
 
LVL 3

Accepted Solution

by:
travisjhall earned 500 total points
ID: 11806406
You are probably better off fixing the "potentially dangerous" value rather than turning off the warning about it, anyway.

I'm no ASP.NET expert, and you haven't posted enough of your code for me to really know much about what is going on, but it looks to me like you've managed to write a lot more than "12" into your variable. It might be that the Response.Write call that you've given us is followed by another Response.Write call that has appended stuff in an inappropriate way.

Perhaps you should show us more of your code, so we might be able to spot what is going on.
0
 
LVL 3

Expert Comment

by:travisjhall
ID: 11876245
I'm a bit surprised that my answer was accepted so easily, as it rather lacked substance. Of course, it's probably just that what I said was all the clue you needed to track down the bug. Still, if you need additional help, feel free to just say so. For 500 question points, I think you're entitled to a bit more help than what I gave, and I'm happy to give more of a hand (and more points really aren't necessary).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Report events not being triggered 8 115
firstswap challenge 20 68
groovy example issue 10 90
This code tracks birthdays 3 60
This is an explanation of a simple data model to help parse a JSON feed
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

11 Experts available now in Live!

Get 1:1 Help Now