//Exporting protected void BtnExportAll_Click(object sender, EventArgs e) { //Collects current method for error tracking string method = "BtnExportAll_Click"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //Sets path and file name to save the export to string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string pathDownload = (pathUser + "\\Downloads\\"); string filename = "AllItems - " + DateTime.Now.ToString("dd.MM.yyyy") + ".xlsx"; FileInfo newFile = new FileInfo(pathDownload + "TotalInventory.xlsx"); //With the craeted file do all intenal code R.CallItemExports("all", newFile, filename, objPageDetails); } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }