-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomErrorHandler.xsl
More file actions
32 lines (26 loc) · 1.16 KB
/
CustomErrorHandler.xsl
File metadata and controls
32 lines (26 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?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"/>
<!-- Define new Error page redirect string -->
<xsl:param name="new404" select="'/Custom404Plugin/NotFound.aspx?app=MyStore&page=NotFound'"/>
<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>
<!-- Define new Error page -->
<error statusCode="404" path="/Custom404Plugin/NotFound.aspx?app=MyStore&page=NotFound" subStatusCode="0" responseMode="ExecuteURL"/>
</httpErrors>
</xsl:copy>
</xsl:template>
<!-- Change 404 redirect -->
<xsl:template match="/configuration/system.web/customErrors/error/@redirect">
<xsl:attribute name="redirect">
<xsl:value-of select="$new404"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>