protected void Page_Load(object sender, EventArgs e) { if ((Request.QueryString["plotId"] == "") && (Request.QueryString["plotId"] == null)) { ErrorLiteral.Text = "Improper Parameter."; } else { int plotId = 0; int.TryParse(Request.QueryString["plotId"].ToString(), out plotId); try { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; String fileName = farmService.ExportContactListToExcel(loginInfo.UserId, plotId); Response.Redirect("~/Members/UserData/" + loginInfo.UserId.ToString() + "/" + fileName); } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE EXPORTING CONTACT LIST:", exception); ErrorLiteral.Text = "Error: Unable to Export Contact List to Excel File"; } } }