Solved

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

Posted on 2004-08-14
4
767 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

20 Experts available now in Live!

Get 1:1 Help Now