示例#1
0
        private void OnRequest(object sender, EventArgs e)
        {
            var app = (HttpApplication)sender;
            if (!app.Request.Url.AbsoluteUri.ToLower().Contains("/onetrueerror/"))
                return;

            var reportId = app.Request.Form["reportId"];
            if (string.IsNullOrEmpty(reportId))
                return;

            var reportDTO = (ErrorReportDTO)TempData[reportId];

            //Not allowed to upload report.
            if (app.Request.Form["Allowed"] != "true" && OneTrue.Configuration.UserInteraction.AskUserForPermission)
            {
                // accessor removes it.
                return;
            }

            if (reportDTO != null)
                OneTrue.UploadReport(reportDTO);

            var info = new UserSuppliedInformation(app.Request.Form["Description"], app.Request.Form["email"]);
            if (!string.IsNullOrEmpty(info.Description) || !string.IsNullOrEmpty(info.EmailAddress))
            {
                OneTrue.LeaveFeedback(reportId, info);
            }

            app.Response.Redirect("~/");
            app.Response.End();
        }
示例#2
0
        /// <summary>
        ///     A user have written information about what he/she did when the exception was thrown; or the user want to get
        ///     information about the bug fixing progress (i.e. want to know when the error is corrected).
        /// </summary>
        /// <param name="errorId">Id generated by this library. Returned when you invoke <see cref="Report(System.Exception)" />.</param>
        /// <param name="feedback">Information from the user.</param>
        public static void LeaveFeedback(string errorId, UserSuppliedInformation feedback)
        {
            if (errorId == null)
            {
                throw new ArgumentNullException("errorId");
            }
            if (feedback == null)
            {
                throw new ArgumentNullException("feedback");
            }

            Configuration.Uploaders.Upload(new FeedbackDTO
            {
                Description  = feedback.Description,
                EmailAddress = feedback.EmailAddress,
                ReportId     = errorId
            });
        }