Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 609
ger Avatar asked Sep 20 '10 14:09

ger


People also ask

How do I trigger a 500 error?

htaccess, you can simply trigger a 500 directly: RewriteRule ^ - [R=500] . (In fact, any invalid syntax would do the job, eg crash ). You don't need the separate folder, you could make the error conditional in your main .

What is error 500 in C#?

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.


1 Answers

throw new Exception(); 

This will generate a HTTP 500

like image 65
Carlos Muñoz Avatar answered Sep 19 '22 19:09

Carlos Muñoz