views:

35

answers:

2

Hi All,

I have a gridview, I am allowing user to enter HTML data while editing a record in a gridview row. When I am clicking update button then I am getting this message

A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$gvCommentDetails$ctl02$ctl04="This is message,
This is mark. ...").

Please let me know how could I resolve this , as I am using sql data source to update the gridview record.

=============

" SelectCommand=" SELECT c.Id,c.Name, c.message FROM Table1 c UpdateCommand=" UPDATE Table1 SET Name = @Name, message = @message WHERE Id= @Id">

Thanks in adavance

A: 

Try updating the following in your web.config

<pages validateRequest="false">
Robert
telling someone to set validateRequest="false" in their web.config without informing of them of the consequences of doing so is a little irresponsible. Read this http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/whitepapers/request-validation/ before changing validateRequest="false"
Dustin Hodges
Thanks alot Kustnodi !! :)
Zerotoinfinite
A: 

Hi Zerotoinfinite,

Basically it means that you can't post values containing HTML ( or script ) tags to the server.

In other words - if you have a textbox and the visitor enters something

This is message, [someHtmlTagGoesHere]

or

This is mark. ...[someTagGoesHere]

and then presses Submit button this error will occur since the posted value(s) contains HTML tags.

To disable request validation on a page add the following directive to the existing "page" directive in the file (you will need to switch to the HTML view for this): ValidateRequest="false"

Hope this helps...

Muse VSExtensions