% Class ErrorController_Class Private m_useLayout Private Sub Class_Initialize() m_useLayout = True End Sub ' JSON API requests (/api/...) get JSON errors without the HTML layout Public Property Get useLayout If IsApiRequest() Then useLayout = False Else useLayout = m_useLayout End If End Property Private Function IsApiRequest() IsApiRequest = (LCase(Left(GetRequestPath(), 5)) = "/api/") End Function Public Property Let useLayout(v) m_useLayout = v End Property Public Sub Index() Response.Write "Index called" End Sub Public Sub NotFound() If IsApiRequest() Then Api_Error 404, "not_found", "No such endpoint." Exit Sub End If Response.Status = "404 Not Found" %> <% End Sub ' The path exists, but not for this HTTP method (resolved by Router_Class.AllowedMethods) Public Sub MethodNotAllowed(allow) If IsApiRequest() Then Api_Error 405, "method_not_allowed", "Use one of: " & allow & "." Else Response.Status = "405 Method Not Allowed" Response.Write "
Method not allowed. Use one of: " & Server.HTMLEncode(allow) & ".
" End If Response.AddHeader "Allow", allow End Sub ' Static action dispatch (AxonASP mishandles runtime-built Eval/Execute calls), ' called through