You might receive this error if your allowing users to enter text into a textbox, then saving the text to the database, and trying to display it on a page. This error might occur if characters or text deemed unsafe by the asp.net request validation feature, are entered by the user. You can easily solve this issue by html encoding input from the user.
So in your code, you would do something like this before saving the text to the database.
Dim strText As String = Server.HtmlEncode(MyTextBox.Text.Trim) SaveToDB(strText)
When you want to display the saved text on a web page you would use something like the following.
Dim strText as String = Some code to retrieve the text from the database MyLabel.Text = Server.HtmlDecode(strText)
This short blog post is meant to be a quick read for this issue. You can read a great article on this subject at http://www.asp.net/faq/requestvalidation.aspx |