问题描述
vb.net项目,当应用程序出现错误例如500错误,不想在错误提示内容中更多的暴露系统的敏感信息,需要在哪配置一下,让报错误的信息简单化,像是指定错误的页面之类的方法,或者不提示代码中因为哪些地方,才出现的错误诸如之类的屏蔽网站漏洞。下面有参考代码,不知道怎么在程序中配置?Inthiscasethe500errorshouldberedirectedtoacustompage:<customErrorsmode="RemoteOnly"defaultRedirect="AppErrors.aspx"><errorstatusCode="404"redirect="NoSuchPage.aspx"/><errorstatusCode="403"redirect="NoAccessAllowed.aspx"/><errorstatusCode="500"redirect="RequestNotAllowed.aspx"/></customErrors>
解决方案
解决方案二:
try{}catch{}
解决方案三:
这样子,已经可以了
解决方案四:
引用1楼的回复:
try{}catch{}
建议不要滥用这东西.直接用customErrors就可以了.
时间: 2024-07-30 20:22:30