How to By Pass Request Validation
Posted
by
GIbboK
on Stack Overflow
See other posts from Stack Overflow
or by GIbboK
Published on 2011-01-02T09:46:09Z
Indexed on
2011/01/02
9:54 UTC
Read the original article
Hit count: 260
Hi, I have a GridView and I need update some data inserting HTML CODE; I would need this data been stored encoded and decoded on request.
I cannot in any way disable globally "Request Validation" and not even at Page Level, so I would need a solution to disable "Request Validation" at Control Level.
At the moment I am using a script which should Html.Encode every value being update, butt seems that "Request Validation" start its job before event RowUpdating, so I get the Error "Page A potentially dangerous Request.Form ... ".
Any idea how to solve it?
Thanks
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
foreach (DictionaryEntry entry in e.NewValues)
{
e.NewValues[entry.Key] = Server.HtmlEncode(entry.Value.ToString());
}
PS I USE Wweb Controls not MVC
© Stack Overflow or respective owner