Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jay Criscione 16 posts 105 karma points
    Aug 08, 2016 @ 19:06
    Jay Criscione
    0

    Whitespace in URL Causes Server Error

    i have several sites that are showing a 500 internal server error when the url contains either a space or %20 as a directory after the domain. ie. http://domain.com/%20/ or "http://domain.com/ /".

    Has anyone run into this, and/or know how to fix it? I have created a new project and adjusted the error handling in the web.config, but am unable to direct this specific error to a general error page.

    thank you in advance for any help.

  • David Peck 690 posts 1896 karma points c-trib
    Aug 10, 2016 @ 09:02
    David Peck
    0

    I get this too, but I don't have any links to /%20/ so it's not a problem. I'd look in to why you're getting links like this. If you can't get rid of them, then try a UrlRewrite to rewrite the url correctly.

  • Jay Criscione 16 posts 105 karma points
    Aug 10, 2016 @ 14:36
    Jay Criscione
    0

    We don't have any links to this URL, it's more an issue of displaying a server error, and I am unable to properly catch and handle the error to display my error page.

    There is little risk, but it is a information disclosure security issue as this error displays information regarding the type of server the website is hosting.

    I have tried to use UrlRewrite, but the error doesn't seem to get far enough through the pipeline to be able to be rewritten.

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Aug 10, 2016 @ 15:39
    Nik
    0

    Hi Jay,

    To catch server level errors (i.e 500), there are a couple of options (others might have alternatives as well).

    1) Check out this blog here: http://benfoster.io/blog/aspnet-mvc-custom-error-pages

    2) At an IIS level on your site you can set .Net Error Pages. These can be configured as a last resort, i.e. nothing else has caught them and you want to hide information about your server.

    Thanks,

    Nik

  • Jay Criscione 16 posts 105 karma points
    Aug 10, 2016 @ 15:46
    Jay Criscione
    0

    Thanks Nik. I will look into your suggestions.

    After continuing to try URL Rewriting, I kept receiving errors regarding the "The configSource file ... is also used in a parent" error. I have moved all the settings into the web.config, which now allows the proper handling of what should be a 404 error.

    Maybe this is a bug in IIS in regards to how it handles the configsource attribute.

Please Sign in or register to post replies

Write your reply to:

Draft