Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow html in asp.net textboxes

I put ValidateRequest="false" in my page directive but the page acts like it's not posting back. If I remove the html then it posts back fine.

Using the text boxes inside an update panel shouldn't make a difference right?

I'm trying to store text in my database with html formatting.

Again, I am using an update panel.

like image 587
The Muffin Man Avatar asked Jan 22 '23 09:01

The Muffin Man


2 Answers

You're probably getting an error behind the scenes. If you take out the update panel do you see a nice YSOD?

If this is a .Net 4.0 application, you'll need to change the web config in order to allow for unsafe characters, even though you turned ValidateRequest to false.

The requisite change looks like this: <httpRuntime requestValidationMode="2.0" />

like image 161
Eric Avatar answered Jan 29 '23 17:01

Eric


Apparently you need to put <httpRuntime requestValidationMode="2.0" /> in web.config to be able to use the ValidateRequest feature in the page directive.

like image 28
The Muffin Man Avatar answered Jan 29 '23 19:01

The Muffin Man