Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在vb.net中处理站点范围内的异常_.net_Vb.net_Exception - Fatal编程技术网

如何在vb.net中处理站点范围内的异常

如何在vb.net中处理站点范围内的异常,.net,vb.net,exception,.net,Vb.net,Exception,当我试图模拟某人篡改我的表单时,我在应用程序中收到此错误 Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, t

当我试图模拟某人篡改我的表单时,我在应用程序中收到此错误

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
回发或回调参数无效。在配置或页面中使用启用事件验证。出于安全目的,此功能验证回发或回调事件的参数是否源自最初呈现它们的服务器控件。如果数据有效且符合要求,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。
我理解它为什么会发生,它保护了我什么,我希望它留在原地。 我想做的是更好地处理它。显示更好的消息,说明您的输入或类似内容有问题,而不是.net崩溃

是否有一种方法可以捕获此异常并在web.config文件中以与状态错误类似的方式处理它

e、 g


好的,所以我做了一些错误记录。发现此异常时产生500错误。我可以在webconfig中通过一个通用重定向来处理这个问题,该重定向将满足我的需要

像这样:

<customErrors mode="On" defaultRedirect="Errors/GenericErrorPage.aspx">
     <error statusCode="500" redirect="Errors/IllegalErrorPage.aspx" />
</customErrors>


感谢那些花时间发表评论的人。

好的,所以我做了一些错误记录。发现此异常时产生500错误。我可以在webconfig中通过一个通用重定向来处理这个问题,该重定向将满足我的需要

像这样:

<customErrors mode="On" defaultRedirect="Errors/GenericErrorPage.aspx">
     <error statusCode="500" redirect="Errors/IllegalErrorPage.aspx" />
</customErrors>


感谢那些花时间发表评论的人。

我想你应该尽可能接近消息来源来处理它,但总有一个选择——只需谷歌就可以了——在很多地方,你可以通过这些链接获得评论和链接。在一个长期运行的webfroms项目中,我们有很多旧表单,但是没有足够的异常处理。。。这将是很好的处理集体为这个特定的问题!给攻击者一条详细的错误消息几乎是最不应该做的事情。你是对的:)不尝试给出详细信息-只是想避免崩溃。然而,如果发生了一些不愉快的事情,我宁愿不给他们一个好的错误页面来帮助他们。我想你应该尽可能地接近源代码来处理它,但总有一个选择——只需谷歌搜索——有很多地方你可以链接到评论和链接。在一个长期运行的webfroms项目中,我们有很多旧表单,但是没有足够的异常处理。。。这将是很好的处理集体为这个特定的问题!给攻击者一条详细的错误消息几乎是最不应该做的事情。你是对的:)不尝试给出详细信息-只是想避免崩溃。然而,如果有什么不好的事情发生,我宁愿不给他们一个漂亮的错误页面来帮助他们。