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 9179693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:51:48+00:00 2026-06-17T17:51:48+00:00

In web.config of my ASP.NET website I have customErrors turned on and set to

  • 0

In web.config of my ASP.NET website I have customErrors turned on and set to redirect to a specific action in case of HTTP 404:

now I start Fiddler and in my browser query some URL that yields HTTP 404. Fiddler clearly shows that first the browser queries that URL and gets HTTP 302 with the path to <...>/Error/FileNotFound and queries that and finally receives HTTP 200.

So effectively the original HTTP 404 disappears and I get HTTP 302 followed by HTTP 200.

Meanwhile if I query some invalid address from StackOverflow (like https://stackoverflow.com/ques/ask) I get HTTP 404 in a single request. I mention this because StackOverflow uses ASP.NET too.

How do I use customErrors in IIS to get HTTP 404 instead of HTTP 302 followed by HTTP 200?

  • 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-06-17T17:51:50+00:00Added an answer on June 17, 2026 at 5:51 pm

    In the customErrors node you can set the following attribute:

    redirectMode="ResponseRewrite"
    

    This will prevent the page from redirecting and will instead write the error page instead of the one requested.

    NB: You will also have to ensure that the page being used as the 404 error page actually itself returns a 404 status code in codebehind; the MS rewrite support doesn’t automatically pass the status code through, see link:

    https://connect.microsoft.com/VisualStudio/feedback/details/507171/asp-net-returns-incorrect-status-code-even-with-redirectmode-responserewrite

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

Sidebar

Related Questions

I have a website that uses basic ASP.Net forms authentication. In the web.config file
I have an asp.net mvc website which of course has a web.config file. I
Suppose I have an ASP.NET website running with its corresponding web.config file, which contains
I use ASP.NET website on IIS7 where in web.config I have: <sessionState mode=InProc timeout=20></sessionState>
I have a question about the web.config in a asp.net website. For a project
I have an ASP.Net web site (ASPX and ASMX pages) with a single web.config
I have configured my Web.Config file as follow in a ASP.NET MVC 2 project:
I have an ASP.NET project which has already some custom fields in it's web.config
I have the following stored in a stores.config file inside my asp.net website's root
I have an ASP.NET website hosted on GoDaddy. I need to redirect (301) every

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.