Esempio n. 1
0
        public static void ReportApplicationException(Exception exception)
        {
            ErrorTracker.Service oService = new Micajah.ErrorTrackerHelper2.ErrorTracker.Service();
            int       applicationID       = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationID"]);
            ErrorInfo errorInfo           = ConvertToErrorInfo(exception, applicationID);

            oService.AddError(errorInfo);
        }
Esempio n. 2
0
        public static ErrorTracker.ErrorInfo SendError(Exception ex)
        {
            if (ex == null)
            {
                return(null);
            }

            ErrorTracker.ErrorInfo oErrorInfo = null;

            if (null == System.Web.HttpContext.Current)
            {
                return(null);
            }
            oErrorInfo = new ErrorTracker.ErrorInfo();


            #region Collecting ErrorInfo Data

            oErrorInfo.ApplicationID = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationID"]);

            try
            {
                WebException.GetExceptions(ex, oErrorInfo);
            }
            catch (TelerikWebResourceException)
            {
                return(null);
            }
            catch (ApplicationStartException)
            {
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Buffer = false;
                System.Web.HttpContext.Current.Response.Write("Error, Site is restarting. Try again later.");
                System.Web.HttpContext.Current.Response.Flush();
                System.Web.HttpContext.Current.Response.End();
                return(null);
            }

            oErrorInfo.Browser          = System.Web.HttpContext.Current.Request.Browser.Browser;
            oErrorInfo.PhysicalFileName = System.Web.HttpContext.Current.Request.PhysicalPath;
            oErrorInfo.UserIPAddress    = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
            oErrorInfo.UserHostName     = System.Web.HttpContext.Current.Request.UserHostName.ToString();
            oErrorInfo.ErrorFile        = System.Web.HttpContext.Current.Request.Url.LocalPath;
            oErrorInfo.URL                    = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
            oErrorInfo.URLReferrer            = null != System.Web.HttpContext.Current.Request.UrlReferrer ? System.Web.HttpContext.Current.Request.UrlReferrer.AbsoluteUri : "None";
            oErrorInfo.MachineName            = System.Web.HttpContext.Current.Server.MachineName.ToString();
            oErrorInfo.Version                = WebException.GetVersionNumbers();
            oErrorInfo.Form                   = WebException.GetForm();
            oErrorInfo.Session                = WebException.GetSession();
            oErrorInfo.QueryString            = System.Web.HttpContext.Current.Request.QueryString.ToString();
            oErrorInfo.QueryStringDescription = WebException.GetQueryString();
            oErrorInfo.ApplicationDescription = WebException.GetApplication();
            oErrorInfo.RequestCookies         = WebException.GetRequestCookies().ToString();
            oErrorInfo.ResponseCookies        = WebException.GetResponseCookies().ToString();
            oErrorInfo.ServerVariables        = WebException.GetServerVariables().ToString();
            string cacheItemsInfo = "";
            oErrorInfo.CacheSize      = WebException.GetCacheSize(ref cacheItemsInfo);
            oErrorInfo.CacheItemsInfo = cacheItemsInfo;

            #endregion

            string errorInfoText = SerializeErrorInfo(oErrorInfo);
            oErrorInfo.QueryStringDescription += string.Format("<br/><hr/>Error Info length: {0}<hr/>", errorInfoText.Length);

            ErrorTracker.Service service = new Micajah.ErrorTrackerHelper2.ErrorTracker.Service();
            service.AddError(oErrorInfo);

            return(oErrorInfo);
        }