.NET Error Message怎么隐藏,或者怎么引向错误页面

问题描述

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

.NET Error Message怎么隐藏,或者怎么引向错误页面的相关文章

Lua error message and traceback

Lua执行遇到错误时, 如果错误信息输出为字符串类型, 那么还会附加两个内容,  1. 输出来源, 例如文件或标准输入 2. 错误位置, 行号.  例如 :  > function foo(str) >> if type(str) ~= 'string' then >> print("line 1\n") >> error("string expected") >> end >> print(&quo

SAP Basis Error Message - Output device LP01 is locked in the SAP system

[绝对原创] SAP Basis SP01 Error Message - Output device LP01 is locked in the SAP system SP01,   Double click the record of 238863, we tried to print for this request, got below error message, 'Output device LP01 is locked in the SAP system',     How to

ASP.NET Parser Error Message: Could not load type &#039;Web.Global&#039;.

Server Error in '/myapp' Application. Parser Error Description:An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Pa

Compiler Error Message: CS0016: Could not write to output file 回绝访问

  Compiler Error Message: CS0016: Could not write to output file 'c:\Windows...dll' 拒绝访问 C:\Windows\Temp"文件夹加上 IIS_IUSRS的完全控制权限

iOS 使用 hidesBottomBarWhenPushed隐藏tabor 底部按钮位置错误

问题描述 iOS 使用 hidesBottomBarWhenPushed隐藏tabor 底部按钮位置错误 用 hidesBottomBarWhenPushed实现隐藏tabbar,如果在将要Push的控制器里用xib创建一个向下对齐的按钮.会先显示按钮下面有一个tabbar距离的空白位置,然后过1秒后按钮才会显示到正常位置,请问这个怎么解决. 解决方案 然后我自己又测试了一下,发现用xib建立的就没问题,storyboard的有问题,我怀疑是sb上的向下参照物是bttom layout造成,但是

浅析网站隐藏内容的几个错误的方式

摘要: 隐藏网站内容的目的是使网站隐藏内容让用户可以看到但搜索引擎抓取不到,大多数情况下我们考虑的问题是如何增加网站的收录,但有些网站在SEO过程如何合理隐藏网站内容减少收录 隐藏网站内容的目的是使网站隐藏内容让用户可以看到但搜索引擎抓取不到,大多数情况下我们考虑的问题是如何增加网站的收录,但有些网站在SEO过程如何合理隐藏网站内容减少收录也是必须考虑到的,例如有些保密信息,广告不想被搜索引擎抓取,另外有些低质量,复制内容阻止搜索引擎抓取对网站更有好处.SEO过程中,隐藏网站内容往往是被站长忽视

Error Message &amp;amp;#x27;There were build errors. Would you like to continue and run the l

问题描述 我不小心将visualC#的ErrorMessage'Therewerebuilderrors.Wouldyouliketocontinueandrunthelastsuccessfulbuild?提醒对话框改成不在提醒了,每次程序运行都是上次成功运行的结果.很是无语,现在怎么改回来啊,求大神帮助... 解决方案 解决方案二:Tool--ImportandExportSetting--Resatallsettingnext....然后你就乐了解决方案三:每次F5之前,先F6,不就得了,

通过IIS访问网站时,报OCIEnvCreate failed with return code -1 but error message text was n

问题描述 急!!!!!!通过iis访问本地网站时,在主页输入用户名.密码后点击登陆,出现以下报错.ServerErrorin'/'Application.OCIEnvCreatefailedwithreturncode-1buterrormessagetextwasnotavailable.Description:Anunhandledexceptionoccurredduringtheexecutionofthecurrentwebrequest.Pleasereviewthestacktra

Compiler Error Message: CS0234: The type or namespace name &amp;amp;#x27;Html&amp;amp;#x27; does not exist

问题描述 项目是MVC设计模式,在本地编译好好的,也能预览:但是发布后部署到服务器上一预览就报错:ServerErrorin'/'Application.--------------------------------------------------------------------------------CompilationErrorDescription:Anerroroccurredduringthecompilationofaresourcerequiredtoserviceth