一个潜在危险的请求错误 [英] A potentially dangerous request error

查看:68
本文介绍了一个潜在危险的请求错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将BCA&#存入asp.net和sql server的文本框中。但我得到错误System.Web.HttpRequestValidationException

从客户端检测到一个潜在危险的Request.Form值(ctl00 $ ContentPlaceHolder1 $ txtName =BCA&#)。



我的尝试:



我发现问题是& #。当&#被写在一起时,它会导致问题。如何在页面指令处不使用ValidateRequest =false来存储此输入。

。我试过

 Server.HtmlEncode(txtName.Text.Trim())

但是也没有用。

解决方案

ContentPlaceHolder1


txtName =BCA&#)。



我的尝试:



我发现问题是&#。当&#被写在一起时,它会导致问题。如何在页面指令处不使用ValidateRequest =false来存储此输入。

。我试过

 Server.HtmlEncode(txtName.Text.Trim())

但是也没有用。


引用:

如何在不使用页面指令的ValidateRequest =false的情况下存储此输入。





您不能,您将不得不禁用该页面的验证并确保您的代码不易受到XSS攻击等的攻击。<​​/ blockquote>

I am trying to store BCA&# entered in textbox in asp.net and sql server. But i got error System.Web.HttpRequestValidationException
A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$txtName="BCA&#").

What I have tried:

i found the issue is &#. when &# is written together it is causing issue. How can i store this input without using ValidateRequest="false" at page directive.

. I tried

Server.HtmlEncode(txtName.Text.Trim())

but is not working too.

解决方案

ContentPlaceHolder1


txtName="BCA&#").

What I have tried:

i found the issue is &#. when &# is written together it is causing issue. How can i store this input without using ValidateRequest="false" at page directive.

. I tried

Server.HtmlEncode(txtName.Text.Trim())

but is not working too.


Quote:

How can i store this input without using ValidateRequest="false" at page directive.



You can't, you're going to have to disable validation for that page and ensure your code is not vulnerable to XSS attacks etc.


这篇关于一个潜在危险的请求错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆