0

I have created an ASP.net 5 MVC6 project and added the following:

  app.UseStatusCodePages();

inside my Configure method. If I run the application, open my web browser and navigate to the following URL:

http://localhost:33358/ReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPathReallyLongInvalidPath

ASP Displays a 404 error message which is the expected behavior. If I navigate to an even longer invalid URL such as:

http://localhost:33358/EvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPathEvenLongerInvalidPath

I now get the following:

Bad Request - Invalid URL

If you navigate to the equivalent MSDN URL you get the same result. However If you navigate to the equivalent stackoverflow URL it is somehow handled. How are they handling this? and how can this be done in ASP.net MVC6?

Community
  • 1
  • 1
Cool Breeze
  • 1,289
  • 11
  • 34

1 Answers1

0

Are you getting a 404.15 ? it might be that the query string length is too long for IIS . Check this https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

Try changing the maxQueryString attribute in thr requestLimits section in web.config to see if it helps.

Pratik
  • 868
  • 1
  • 9
  • 24
  • Nope. I am getting the same error as when clicking on the MSDN link. – Cool Breeze Feb 01 '16 at 10:29
  • I am not sure if the sub status code information is shown directly on the error page. There are ways to redirect to different pages based on the sub status code. But i am not sure if these configurations work in MVC 6 ( http://www.iis.net/learn/troubleshoot/diagnosing-http-errors/how-to-use-http-detailed-errors-in-iis ). The work for this may not have been finished yet. – Pratik Feb 01 '16 at 10:39
  • I am pretty sure that its not even getting that far. Similar to when visiting a URL such as: http://stackoverflow.com/% – Cool Breeze Feb 02 '16 at 07:32