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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:14:12+00:00 2026-06-06T15:14:12+00:00

using the default route routes.MapRoute( Admin, // Route name Admin/{action}, // URL with parameters

  • 0

using the default route

  routes.MapRoute(
      "Admin",                                              // Route name
      "Admin/{action}",                           // URL with parameters
      new { controller = "Admin", action = "Index" }  // Parameter defaults
  );

lots of routes (approx. 90%) for our application are working, so that’s fine.

Now when the user enters /logon/strangeroute, MVC offcourse throws an error because i don’t have the strangeroute action in my logoncontroller.

Using the catch all exception handler in the global.asax.cs, i can’t find to get the difference between routing errors (i call this a routing error) and another error (thrown in the rest of the code).

I would like to discriminate betweek the types of errors because when the route gives an error it most of the time is a 404 error, and i want to redirect the user to the 404 page and not to the normal, generic, error page.

One soultion would be to create all the routes for all the pages and dismiss the existing default route and implement a catch-all route but i’d prefer not to create a separate route for every url.

Is there another way of doing this?

  • 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-06T15:14:14+00:00Added an answer on June 6, 2026 at 3:14 pm

    Test if the Exception you caught is an HttpException and if it is use the GetHttpCode method on it to see if it is 404.

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

Sidebar

Related Questions

route : routes.MapRoute(Default, {controller}/{action}/{id}/{args1}/{args2}/{args3}, // URL with parameters new { controller = Home, action
Suppose I have the following routing routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL
Given these routes: routes.MapRoute(Test, test, new { controller = Test, action = Index });
I'm using following code to get the controller/action information from RouteData RouteData route =
I've got the default route set-up: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute({resource}.axd/{*pathInfo}); routes.MapRoute(
I am using asp.net mvc 2 and create localization based on routes. my route
I have two routes in my area, one custom and one default fallback route,
How do I change the order of the url parameter when registering routes in
Im using routes.add instead of routes.maproute (which has a namespace arg) because I extended
I have webserver using default virtualhost apache <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory

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.