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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:35:34+00:00 2026-05-22T15:35:34+00:00

When a bad url is used, and all chars are accepted – either using

  • 0

When a bad url is used, and all chars are accepted – either using registry of .config keys (see other “duplicates” posts for more info), asp.net mvc crashes.

What is the best interception point to prevent/handle the exception ?

Sample urls

http://www.local.com/some/url/pagehttp://www.local.com/some/url/page
http://www.local.com/some/url/page:12

Sample exception

System.NotSupportedException
The given path’s format is not supported.

at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) 
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) 
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) 
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) 
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path) 
at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) 
at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) 
at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) 
at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext) 
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) 
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() 
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) 
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) 
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) 
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
  • 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-22T15:35:35+00:00Added an answer on May 22, 2026 at 3:35 pm

    Fixed.

    Add this to your Application_Start:

    filters.Add(new MyHandleErrorAttribute { Order = 1, ExceptionType = typeof(NotSupportedException) });
    

    And put this class into your project:

    public class MyHandleErrorAttribute : System.Web.Mvc.HandleErrorAttribute {
      public override void OnException(ExceptionContext filterContext) {
         if (filterContext.IsChildAction || filterContext.ExceptionHandled || !ExceptionType.IsInstanceOfType(exception) || exception.Message != "The given path's format is not supported." ) 
           return;
      }
    
      base.OnException(filterContext);
      filterContext.HttpContext.Response.StatusCode = 404;
    }
    

    Then you can handle the 404 in your Application_Error.

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

Sidebar

Related Questions

I have read that using database keys in a URL is a bad thing
Either I had a bad dream recently or I am just too stupid to
I keep getting: Unable to create request (bad url?) error message on a request
Currently we are using a Kentico CMS for out web site and we used
I constantly hear how bad reflection is to use. While I generally avoid reflection
I'm doing something bad in my ASP.NET app. It could be the any number
Is it particularly bad to have a very, very large SQL query with lots
Why is it bad practice to declare variables on one line? e.g. private String
Why is it bad to name a variable id in Python?
I got this bad feeling about how I insert larger amounts of HTML. Lets

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.