如何模拟在我的ASP.NET应用程序HTTP 500错误? [英] How to simulate an HTTP 500 error on my ASP.NET app?

查看:140
本文介绍了如何模拟在我的ASP.NET应用程序HTTP 500错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想模拟这个错误,所以我可以检查会显示一个一般性的错误页面,而不是HTTP 500之一,在最近的安全漏洞的光。

我们包括网站自身的特殊处理404和403,所以我想,以确保没有错误特殊处理工作了。


解决方案

 抛出新的异常();

这将产生一个HTTP 500

I want to simulate this error so I can check a generic error page is displayed, not the HTTP 500 one, in light of the recent security vulnerability.

We include special processing in the site itself for 404 and 403 so I want to make sure that errors without special processing work too.

解决方案

throw new Exception();

This will generate a HTTP 500

这篇关于如何模拟在我的ASP.NET应用程序HTTP 500错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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