locked
Custom error page for "Query timeout expired" errors? RRS feed

  • Question

  • User1861004525 posted

    hi

    Windows Server 2008 R2 running IIS 7.5
    We have a page that pulls data from an SQL database and displays the data in a table. Sometimes (depending on the time of day) the database is getting hit quite a lot and the query the pages times out - which is fine as this would be a low priority query request anyway.

    However, IIS simply displays a basic "query timed out" error.
    Is it possible to replace this with a custom error page? (We already have one in place for 404 errors).

    Monday, April 19, 2021 9:29 AM

All replies

  • User1065476709 posted

    Hi Chenks76,

    Yes, the following configuration example demonstrates how to specify the error handling pages to use for an ASP.NET application.

    <configuration>
      <system.web>
      <customErrors defaultRedirect="GenericError.htm" mode="RemoteOnly">
        <error statusCode="404" redirect="InternalError.htm"/>
        </customErrors>
      </system.web>
    </configuration>

    More information you can refer to this link: customErrors Element.

    Best regards,

    Sam

    Tuesday, April 20, 2021 1:57 AM
  • User1861004525 posted

    Yes, the following configuration example demonstrates how to specify the error handling pages to use for an ASP.NET application.

    it's not an asp.net application though.

    and i do already know how to set up customer errors (for 404 etc).

    i was asking about this specific error.

    Tuesday, April 20, 2021 7:05 AM
  • User1065476709 posted

    Hi Chenks76,

    i was asking about this specific error.

    Do you have an error code for this specific error? If not, you can use iis url rewrite to redirect this error page to 404.

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

    Best regards,

    Sam

    Wednesday, April 21, 2021 8:33 AM
  • User1861004525 posted

    Do you have an error code for this specific error? If not, you can use iis url rewrite to redirect this error page to 404.

    hi

    all that i have is what is displayed on screen - which is what the screenshot in the opening post shows.

    Wednesday, April 21, 2021 8:38 AM
  • User1065476709 posted

    Hi Chenks76,

    all that i have is what is displayed on screen - which is what the screenshot in the opening post shows.

    Then I suggest you use url rewrite.

    Best regards,

    Sam

    Wednesday, April 21, 2021 8:41 AM
  • User1861004525 posted

    Then I suggest you use url rewrite.

    URL rewrite based on what though?
    i would need to create a rewrite rule for every single page where this might happen?

    the error is displayed in the content of the page (and numerous others that do a similar thing), not the URL

    Wednesday, April 21, 2021 8:46 AM
  • User1065476709 posted

    Hi Chenks76,

    URL rewrite based on what though?
    i would need to create a rewrite rule for every single page where this might happen?

    the error is displayed in the content of the page (and numerous others that do a similar thing), not the URL

    You can redirect the url of the error page to 404.

    Best regards,

    Sam

    Wednesday, April 21, 2021 8:53 AM
  • User1861004525 posted

    Hi Chenks76,

    Chenks76

    URL rewrite based on what though?
    i would need to create a rewrite rule for every single page where this might happen?

    the error is displayed in the content of the page (and numerous others that do a similar thing), not the URL

    You can redirect the url of the error page to 404.

    Best regards,

    Sam

    the existing "error page" doesn't have it's own URL, the content of the existing URL displays the error shown in the screenshot.

    so if i load https://blah.com/tableresults.asp the error is displayed within the content of that page

    same if the page is https://blah.com/tableresults2.asp

    Wednesday, April 21, 2021 9:01 AM
  • User1065476709 posted

    Hi Chenks76,

    the existing "error page" doesn't have it's own URL, the content of the existing URL displays the error shown in the screenshot.

    How do you access the page without the url?

    so if i load https://blah.com/tableresults.asp the error is displayed within the content of that page

    same if the page is https://blah.com/tableresults2.asp

    In the url rewriting rule, you can use parameters to match only tableresults.asp.

    Best regards,

    Sam

    Thursday, April 22, 2021 7:36 AM
  • User1861004525 posted

    Hi Chenks76,

    Chenks76

    the existing "error page" doesn't have it's own URL, the content of the existing URL displays the error shown in the screenshot.

    How do you access the page without the url?

    Chenks76

    so if i load https://blah.com/tableresults.asp the error is displayed within the content of that page

    same if the page is https://blah.com/tableresults2.asp

    In the url rewriting rule, you can use parameters to match only tableresults.asp.

    Best regards,

    Sam

    i think either you are not understanding me fully or i am not understanding you fully.

    the error i am getting is not an "error" page, but rather just a message displayed within the conten of the page that a timeout error occured when the page tried to run an SQL query.

    the URL is just the URL of the actual page, not the URL of an IIS "error" page.

    this error could occur on any page, not just the specific example i gave.

    if you are saying this can be achieved using a URL rewrite in the say way a 404 error would be handled (which i already configured), then please explain in a little more detail, as from what i can see it's not possible.

    Thursday, April 22, 2021 7:46 AM
  • User1065476709 posted

    Hi Chenks76,

    the error i am getting is not an "error" page, but rather just a message displayed within the conten of the page that a timeout error occured when the page tried to run an SQL query.

    the URL is just the URL of the actual page, not the URL of an IIS "error" page.

    If it is an error in the SQL query query, it cannot be replaced with a custom error page, you can only use one url to replace another url.

    Best regards,

    Sam

    Friday, April 23, 2021 8:59 AM