2

From this https://stackoverflow.com/a/18404091/24267 I gather that

The customErrors attribute is used when the .net code is throwing an exception (404, 403, 500 etc) and the httpErrors attribute is used when IIS itself is throwing an exception.

I want QA to be able to test my 500 page. It's easy enough to throw an asp.net exception to test customErrors ("throw new Exception()" in an .aspx page), but how do I force IIS to throw an exception to test httpErrors?

Community
  • 1
  • 1
mhenry1384
  • 7,538
  • 5
  • 55
  • 74
  • 3
    add a page to your site, and add `Response.StatusCode` to the error value you want in that page initialization and let `CustomErrors` handle that error – techspider Aug 09 '16 at 17:42

1 Answers1

4

I had the same requirement and appreciated @techspider's suggestion. Building on that I thought I'd post the minimal ASPX file I used to trigger the error, to save someone else refreshing themselves on ASPX syntax like I just did.

<%@ Page Language="C#" %>

<%
  Response.StatusCode = 500;
%>
mhenry1384
  • 7,538
  • 5
  • 55
  • 74
Michael12345
  • 2,520
  • 5
  • 23
  • 41