Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 361319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:53:00+00:00 2026-05-12T12:53:00+00:00

I have developed a web app a year ago aimed to work with IIS6.

  • 0

I have developed a web app a year ago aimed to work with IIS6.
Now we are moving to IIS7 and I thought, I’d do some integration tests.

One of this fails:
The web app is more or less a search-engine, giving a 404 or 500 (thanks to your google-advisor …) when there weren’t any results or the data-container is not loaded yet. With IIS6 this worked great: The page output was eg. result.aspx, showing some message and giving back the specified http status (set at codebehind).
Now with IIS7 this behaviour is broken: If I set the http status code at codebehind, my page won’t be delivered anymore – instead showing the generic error page of IIS7.

No, I do not want to do any dirty hack with the customErrors-Section …
I just want the original behaviour back!
Is there any way to do this?

Edit:
Consider following page

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

<script runat="server">
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        this.Response.StatusCode = 404;
    }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        This page should be displayed
    </div>
    </form>
</body>
</html>

Vista + IIS7 = OK
2008 Server + IIS7 = Generic Error Page

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:53:01+00:00Added an answer on May 12, 2026 at 12:53 pm

    have you tried this:

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.Response.StatusCode = 404;
    
        Response.TrySkipIisCustomErrors = true;
    }
    

    HttpResponse.TrySkipIisCustomErrors Property (System.Web)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two web applications and both are developed in ASP.NET. Now I want
I am developing a web application which has Chart Controls. I have developed a
I have a web application developed with ASP.net and C# that is running on
I have a web project that I developed where one of the main functions
I have created a web service which has a couple of methods developed using
I am a web-developer working in PHP. I have some limited experience with using
We have an in house developed web-based admin console that uses a combination of
I have a windows mobile app developed under windows XP / Visual Studio 2008.
I have a webapp development problem that I've developed one solution for, but am
I am primary a web developer but I do have a very good understanding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.