locked
web.config custom errors RRS feed

  • Question

  • User694418659 posted

    Hello,

    I the following code in my web.config to redirect users - 

    <customErrors mode="On" defaultRedirect="general-error.aspx">
    <error statusCode="404" redirect="notfound.aspx" />
    <error statusCode="403" redirect="restricted.aspx" />
    </customErrors>

    The 404 works as expected, but not the 403 (the error redirect page does exist). For example, if I browse to http://www.xyz.com/abc and I am not authorised to access the abc folder I still receive the generic IIS 403.6 error message. What am I doing wrong?

    Thanks, Mart

    Tuesday, February 5, 2019 9:11 AM

Answers

  • User694418659 posted

    Ah yes. Sorry. Web host sorted it out. Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 15, 2019 9:48 AM

All replies

  • User753101303 posted

    Hi,

    403.6 seems an IP address restriction. Could it be that your restricted.aspx page is also at a place where this IP restriction is also in place ? If confirmed see if you can lift this resriction for this page or maybe for a folder where you would put error pages...

    Tuesday, February 5, 2019 9:32 AM
  • User694418659 posted

    Yes, we restrict access to one folder via IP. However, all error pages reside in the root folder which is not restricted.

    Mart

    Tuesday, February 5, 2019 9:41 AM
  • User753101303 posted

    What if you try to access this page directly from your browser ? If I remember I'm using 

    redirect="~/restricted.aspx" to make sure the page is taken from the root.

    Tuesday, February 5, 2019 10:17 AM
  • User694418659 posted

    Also didn't work. :-(
    Have asked our web hosts if there is a way of doing it through their interface.

    Mart

    Tuesday, February 5, 2019 10:21 AM
  • User283571144 posted

    Hi stabes,

    Any update? As PatriceSc says, the 403.6 is  IP address restriction.  You should check the web host setting.

    Best Regards,

    Brando

    Friday, February 15, 2019 9:44 AM
  • User694418659 posted

    Ah yes. Sorry. Web host sorted it out. Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 15, 2019 9:48 AM