70
Views
4
Comments
400, 405
Question

Hello, i have configured custom error handling page for status code 404 with factory configuration and it works. But when i try to include 400 and 405 status code it is not working. How can i add these two status code to web.config?

Rank: #901

Hi Phone, 

Have you checked by Add new line for different error between <httpErrors> tag? 

like : 

<httpErrors>

         <error statusCode="400" path="" SubStatusCode="0" responseModel="" />

         <error statusCode="405" path="" SubStatusCode="0" responseModel="" />

</httpErrors>


Can you please try with this option.


Thanks 

Rank: #1416

Jitender Gaur wrote:

Hi Phone, 

Have you checked by Add new line for different error between <httpErrors> tag? 

like : 

<httpErrors>

         <error statusCode="400" path="" SubStatusCode="0" responseModel="" />

         <error statusCode="405" path="" SubStatusCode="0" responseModel="" />

</httpErrors>


Can you please try with this option.


Thanks 


Hi Jitender Gaur, I've tried that option. It does not work. Any solution?

Staff
Rank: #268

<xsl:template match="/configuration/system.web/customErrors/error">

<xsl:copy>

<xsl:attribute name="statusCode">404</xsl:attribute>

<xsl:attribute name="redirect">/parent/PageNotFound.aspx</xsl:attribute>

</xsl:copy>

</xsl:template>


This is something that is working it has some differences from what you have. Not sure if those differences are important. 

Yet is with the same status code that is working for you. I'd assume that adding new lines for new status codes would work. 

Have you tried creating a new entry on Factory Configuration for another status code? (instead of being in the same entry)

Rank: #441

We checked with below sample and working for me for 503 and 404.


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" encoding="UTF-8"/> 

    <xsl:template match="@*|node()">

        <xsl:copy>

            <xsl:apply-templates select="@*|node()"/>

        </xsl:copy>

    </xsl:template>

    <xsl:template match="/configuration/system.webServer">

        <xsl:copy>

            <xsl:apply-templates select="@*|node()"/>

            <httpErrors>

                <error statusCode="404" path="/CustomError/PageNotFound.aspx" subStatusCode="0" responseMode="ExecuteURL"/>

                <error statusCode="503" path="/CustomError/Error.aspx" subStatusCode="0" responseMode="ExecuteURL"/>

            </httpErrors>

        </xsl:copy>

    </xsl:template>

</xsl:stylesheet>