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

前端 未结 6 2012
甜味超标
甜味超标 2020-12-29 04:37

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 speci

6条回答
  •  天涯浪人
    2020-12-29 05:24

    Here's a way to do this without modifying your site in any way:

    1. From your web browser, open a page on your site that has a postback form.
    2. Press F12 to open developer tools.
    3. From the HTML tab, search for __VIEWSTATE and change the value in any way.
    4. Post to the form

    This will cause a "Validation of viewstate MAC failed" ASP.Net Exception, which returns a 500 internal server error HTTP response code.

    Breaking the web.config with a malformed tag also works, but defeats the purpose if you are trying to test some settings in your web.config (like Failed Request Tracing).

提交回复
热议问题