ASP.NET Custom Error Page Not Displayed for Abnormal URLs

Someone asked on Stack Overflow:

A vulnerability scanning service regularly tests our site for PCI scan compliance. It has just started trying to access URLs with abnormal formatting, such as:

http://www.mydomain.com/ShoppingCart.aspx//ErrorPage.aspx%3fid%3d2?

We have a Custom Error Page set which works for everything except this. Is there any way to force IIS to display it for this type of URL?

The Error: Runtime Error - An application error occurred on the server…

We’re using:

  • ASP.NET 2.0 (Framework 3.5)
  • IIS 7.0 (Windows Server Web 2008)

I’ve tried to debug this, but I can’t reproduce this on IIS 6.0.

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

There might be a more simple solution, but if you’re on IIS7 you can use URL Rewrite to match those type of URLs and map them back to your error page.


Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.

signed letter b

Dad. Geek. Gamer. Software developer. Cloud user. Old Car enthusiast.  Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.