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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:02:02+00:00 2026-06-05T02:02:02+00:00

how to handle 400 bad request like stackoverflow in mvc 3 , iis 6

  • 0

how to handle 400 bad request like stackoverflow in mvc 3 , iis 6 ?

eg: http://www.stackoverflow.com/a<

return 404 not found page , instead of a YSOD page

updated: why this does not work ?

  <httpErrors errorMode="Detailed">
     <remove statusCode="404" subStatusCode="-1" />
     <error statusCode="404" subStatusCode="-1" path="/notfound" responseMode="ExecuteURL" />
     <error statusCode="400" subStatusCode="-1" path="/Error" responseMode="ExecuteURL" />
  </httpErrors>
  • 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-05T02:02:05+00:00Added an answer on June 5, 2026 at 2:02 am

    Use customErrors tag of web.config:

    <customErrors mode="On" defaultRedirect="UrlToRedirect" >
      <error statusCode="400" redirect="UrlToRedirect"/>
    </customErrors>
    

    Eg.:

    <customErrors mode="On" defaultRedirect="~/Error/Index">
      <error statusCode="400" redirect="~/Error/Index"/>
    </customErrors>
    

    if UrlToRedirect = “~/Error/Index”, Here, in this url, “Error” is the name of controller & “Index” is the name of Action method which returns Error View Page.

    public class ErrorController : Controller
        {
            public ActionResult Index()
            {
                return View("Error");
            }
        }
    

    In the “\Views\Shared Folder” of you application, you have “Error.cshtml” view page.

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

Sidebar

Related Questions

I'm receiving a 400 bad request error w/ the following code: This is my
How would I write a route in Asp.Net mvc to handle a url like
I have a file handle to a serial (COM) port. I need to read
How to handle invalid URLs in MVC? For ex.: When the user enters http://localhost/User/MyProfile
I am building an MVC 3 application with an IIS 7.5 backend. On my
I am building a registration form with jquery which should handle the request via
I am working on a RoR website and would like to handle server errors
I'm writting a webapp that should be able to handle a request as following:
I handle commands inside a RoutedCommand class that implements RoutedUICommand. This would help me
I handle a website which is designed in GWT and I want to check

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.