0

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?

5
  • Are you getting an exception when posting HMTL to the page? Commented Mar 4, 2011 at 12:01
  • Which version of .NET Framework are you using? Is it 4.0? Commented Mar 4, 2011 at 12:04
  • 1
    Is the content being sent to the client - do a view source on the page. This should determine if it's a style or server render issue. Commented Mar 4, 2011 at 12:14
  • in what sort of control are you trying to show the inserted html? do you have some sample code? Commented Mar 4, 2011 at 12:18
  • tring to show in text box, but that text box in grid (panel --> grid --> textbox) Commented Mar 4, 2011 at 12:30

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm using 2.0 only. Also getting this error Unrecognized attribute 'requestValidationMode'. Note that attribute names are case-sensitive.
0

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;

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.