C# 有人见过这样的例外吗?

C# 有人见过这样的例外吗?,c#,asp.net,security,C#,Asp.net,Security,我的全局异常处理程序(在global.asax.cs中)捕获了一些异常。这些源于允许从网站发送电子邮件的页面。此页面包含3个文本框供用户输入,我怀疑这些异常可能是由于在文本框中键入恶意代码造成的。这是错误消息: A potentially dangerous Request.Form value was detected from the client (ctl00$contentPageSpecificMain$textBoxBody=", <a href="http://f1g

我的全局异常处理程序(在global.asax.cs中)捕获了一些异常。这些源于允许从网站发送电子邮件的页面。此页面包含3个文本框供用户输入,我怀疑这些异常可能是由于在文本框中键入恶意代码造成的。这是错误消息:

    A potentially dangerous Request.Form value was detected from the client (ctl00$contentPageSpecificMain$textBoxBody=",
<a href="http://f1ga...").; stack=   at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.get_Form()
   at System.Web.HttpRequest.get_HasForm()
   at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
   at System.Web.UI.Page.DeterminePostBackMode()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.contact_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously);
一个潜在危险的请求。从客户端检测到表单值(ctl00$contentPageSpecificMain$textBoxBody=“,

如果您希望自己直接处理验证,可以将TextBox控件上的ValidateRequestMode设置为Disabled(禁用)。可以在设计时或在代码中完成此操作。这允许您处理输入,而不会首先被Asp.net处理程序捕获

TextBox1.ValidateRequestMode = Disabled;

这样做的好处是,您可以将标志设置为适合您的应用程序的任何级别,继承将允许它向下延伸,而无需为应用程序或整个页面设置“如果”。

可能重复潜在危险的请求。从客户端检测到表单值(textboxError=”所以有人试图在你的文本框中发布链接?;p你应该清理所有这些字符串。尤其是;(分号)电子邮件收件人/发件人字段中的字符。
我阻止小于或大于符号
-如果在JavaScript中执行此操作,则很容易在客户端重写此行为。如果您在代码中执行此操作,ASP.NET将在您的代码之前解析输入,并给出此错误。此属性是在.NET Framework 4.5中添加的