protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Page.Title = "Bulk Email Delete"; H1.InnerHtml = "Bulk Email Delete"; Master.MasterForm.Attributes.Add("enctype", "multipart/form-data"); } else { _Messages = new List <string>(); for (var i = 0; i < Request.Files.Count; i++) { var file = Request.Files[i]; if (file.ContentLength == 0) { continue; } try { var address = EmailUtility.ExtractUndeliverableEmailAddressFromMsg(file.InputStream); if (DeleteCheckBox.Checked) { DoDeletions(address); } else { AnalyzeDeletions(address); } } catch (Exception ex) { _Messages.Add( $"<p class=\"error\">Error processing file: {file.FileName}, {ex.Message}</p>"); } } foreach (var address in ExtraAddresses.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries) .Select(a => a.Trim())) { if (DeleteCheckBox.Checked) { DoDeletions(address); } else { AnalyzeDeletions(address); } } SummaryPlaceHolder.Controls.Add(new LiteralControl(string.Join(string.Empty, _Messages))); SummaryContainer.RemoveCssClass("hidden"); } }