Problem with Request Validation

728 views Asked by At

In order to display some special text (like html data) I put validaterequest="false" in my aspx page. But unfortunatly I'm not even get that text to display.

So how can i display that (Html enabled) content?

3

There are 3 answers

0
Willem On

If the TextBox is in a databound control (Repeater/GridView/etc.) and you bind the data on every postback the TextBox will lose it's contents, because all contents of the control are recreated. Use if(!Page.IsPostBack){/*code*/} to make sure it only databinds on first load.

1
Mikael Östberg On

If you experience that validateRequest="false" has no effect, it may be helped by setting this in web.config:

<system.web>
  <httpRuntime requestValidationMode="2.0" />
</system.web>

Which reverts to the behavior of the ASP.NET 2.0 request validation feature.

0
AudioBubble On

if you want to display the html text. Place a asp:Literal contol on the form where you want to display the text. e.g.

ASPX:
<asp:Literal ID="outputHtml" runat="Server">

CS:

outputHtml.Text = your_var_having_html;