ger ger - 1 year ago 179
ASP.NET (C#) Question

How to simulate an HTTP 500 error on my ASP.NET app?

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.

Answer Source
throw new Exception();

This will generate a HTTP 500

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download