Gravar caracteres especiais
Olá pessoal,Tenho em minha tabela um campo do tipo memo, mas tem casos em q preciso colocar aspas, sinais de maior e menor e outros caracteres. Só q, quando salvo, dá um erro. Por exemplo:
Protected Sub BtnGravar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGravar.Click Dim Conexao As MySqlConnection Dim myCommand As New MySqlCommand Conexao = New MySqlConnection(Cx) Conexao.Open() myCommand.Connection = Conexao myCommand.CommandText = "INSERT INTO tb_historias (Hist_Autor, Lit_Codigo, Hist_Titulo, Hist_Redacao, Usu_Codigo) " & _ " VALUES (?P1, ?P2, ?P3, ?P4, ?P5)" myCommand.Prepare() myCommand.Parameters.Add("?P1", UCase(Trim(TxtAutor.Text))) myCommand.Parameters.Add("?P2", DropLiteratura.SelectedValue) myCommand.Parameters.Add("?P3", UCase(Trim(TxtTitulo.Text))) myCommand.Parameters.Add("?P4", Trim(TxtRedacao.Text)) myCommand.Parameters.Add("?P5", LbUsuCodigo.Text) myCommand.ExecuteNonQuery() LimparCampos(Page.Controls) TxtTitulo.Focus() End Sub
O erro é este:
A potentially dangerous Request.Form value was detected from the client (TxtRedacao="...ntem."<b>Moral da história..."). Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (TxtRedacao="...ntem."<b>Moral da história...").
Como faço para corrigir isso?
Discussão (6)
Carregando comentários...