public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude           = RaygunSettings.Settings.ExcludedStatusCodes;
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Any();
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            // If no version is set, attempt to retrieve the version from the assembly.
            if (string.IsNullOrEmpty(RaygunSettings.Settings.ApplicationVersion))
            {
                var entryAssembly = GetWebEntryAssembly(context);
                if (entryAssembly != null)
                {
                    RaygunSettings.Settings.ApplicationVersion = entryAssembly.GetName()?.Version?.ToString();
                }
            }

            var mvcAssembly = AppDomain.CurrentDomain?.GetAssemblies()?.FirstOrDefault(a => a.FullName.StartsWith("Mindscape.Raygun4Net.Mvc,"));

            if (mvcAssembly != null)
            {
                var type   = mvcAssembly.GetType("Mindscape.Raygun4Net.RaygunExceptionFilterAttacher");
                var method = type.GetMethod("AttachExceptionFilter", BindingFlags.Static | BindingFlags.Public);
                method.Invoke(null, new object[] { context, this });
            }

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }
Example #2
0
        public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude           = RaygunSettings.Settings.ExcludedStatusCodes;
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Any();
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            var mvcAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName.StartsWith("Mindscape.Raygun4Net.Mvc,"));

            if (mvcAssembly != null)
            {
                var type   = mvcAssembly.GetType("Mindscape.Raygun4Net.RaygunExceptionFilterAttacher");
                var method = type.GetMethod("AttachExceptionFilter", BindingFlags.Static | BindingFlags.Public);
                method.Invoke(null, new object[] { context, this });
            }

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }
Example #3
0
        public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude = new int[0];
            if (!string.IsNullOrEmpty(RaygunSettings.Settings.ExcludeHttpStatusCodesList))
            {
                List <int> codes = new List <int>();
                string[]   parts = RaygunSettings.Settings.ExcludeHttpStatusCodesList.Split(',');
                foreach (string code in parts)
                {
                    int c;
                    if (int.TryParse(code, out c))
                    {
                        codes.Add(c);
                    }
                }
                HttpStatusCodesToExclude = codes.ToArray();
            }
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Length > 0;
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }