Copied to clipboard

Flag this post as spam?

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


  • Yoni 49 posts 118 karma points
    Jul 26, 2014 @ 23:20
    Yoni
    0

    Umbraco 7 - Global.asax - Application_Error

    I am trying to write my own "Application_Error" for my site.

    I need to catch 404's (to see what mistakes users are making) & 500's to catch my programming errors. I did this succesfully in my site before I started using Umbraco in the global.asax.

     

    I have tried the following method.

    1: I created a class MyGlobal (file MyGlobal.vb in the App_Code directory:

     

    Public Class MyGlobal
        Inherits umbraco.Web.UmbracoApplication
    
    
    
        Protected Overloads Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    
    
            Dim ctx As HttpContext = HttpContext.Current
            ctx.Response.Redirect("http://wwww.google.com")
        End Sub
    End Class

    Obivously, this is only to test.

    In addition, I editeted my Global.asax file and now it looks like this:

    <%@ Application Language="VB"   Inherits="MyGlobal" %>
    
    <script runat="server">
    
    </script>

    I already have "<customErrors mode="Off" />" in my web.config as well as "<httpErrors existingResponse="PassThrough"/>"

    1: When I try to enter a non-existent page, i get the Umbraco 404 error page.

    2: When I purposely create a 500 error, the system shows me the error page and does not redirect to Google.

     

    Please help as I can not go live without this.

     

    Thanks.

    Yoni

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies