Hello everybody,
On my button click event, I am getting Redirect URI cannot contain newline characters exception. I do not have any Response.Redirect in my event handler routine. Here's my code.
Any ideas??Code:private void btnAddCustomer_Click(object sender, System.EventArgs e) { try { if(ValidateClientSide()) { DataTable dtPlan = new DataTable(); PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.Plan plan = new PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.Plan(); dtPlan = plan.GetPlanByName("Evaluation Plan"); long planID = 0; string membershipDate = DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + DateTime.Now.Year.ToString(); string expiryDate = ""; bool isActive = false; string amount = "0"; long paymentTypeID = 0; long paymentModeID = 0; if(dtPlan.Rows.Count > 0) { planID = Convert.ToInt32(dtPlan.Rows[0]["ID"]); long numDays = Convert.ToInt32(dtPlan.Rows[0]["NumDays"]); DateTime tempExpiryDate = new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day).AddDays(numDays); expiryDate = tempExpiryDate.ToShortDateString(); amount = dtPlan.Rows[0]["Amount"].ToString().Trim(); } PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.PaymentType paymentType = new PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.PaymentType(); DataTable dtPaymentType = new DataTable(); dtPaymentType = paymentType.GetPaymentTypeByName("New Member"); if(dtPaymentType.Rows.Count > 0) paymentTypeID = Convert.ToInt32(dtPaymentType.Rows[0]["ID"]); PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.PaymentMode paymentMode = new PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.PaymentMode(); DataTable dtPaymentMode = new DataTable(); dtPaymentMode = paymentMode.GetPaymentModeByName("No Payment"); if(dtPaymentMode.Rows.Count > 0) paymentModeID = Convert.ToInt32(dtPaymentMode.Rows[0]["ID"]); string customerNumber = InsertCustomer(txtPassword.Text.Trim(),membershipDate,expiryDate,txtFirstName.Text.Trim(),txtLastName.Text.Trim(),txtEmail.Text.Trim(),txtCompanyName.Text.Trim(),txtPhoneNumber.Text.Trim(),txtCellNumber.Text.Trim(),txtAddress.Text.Trim(),txtCity.Text.Trim(),txtState.Text.Trim(),txtZipCode.Text.Trim(),Convert.ToInt32(cboCountries.SelectedValue),planID,isActive,amount,paymentTypeID,paymentModeID); string result = "You account has been created and a confirmation email has been sent to your email address with details to activate the account."; DataTable dtEmailMessage = new DataTable(); PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.EmailMessage emailMessage = new PCSN.SurveyApplicationCustomerArea.BusinessLogicLayer.EmailMessage(); dtEmailMessage = emailMessage.GetEmailMessageForNewCustomer(); string fromAddress = ""; string toAddress = ""; string subject = ""; string message = ""; string url; if(dtEmailMessage.Rows.Count > 0) { fromAddress = dtEmailMessage.Rows[0]["FromAddress"].ToString().Trim(); subject = dtEmailMessage.Rows[0]["Subject"].ToString().Trim(); message = dtEmailMessage.Rows[0]["Message"].ToString().Trim(); } DataTable dtCustomer = new DataTable(); dtCustomer = GetCustomerByCustomerNumber(customerNumber); toAddress = dtCustomer.Rows[0]["Email"].ToString().Trim(); url = FormatUrl(dtCustomer.Rows[0]["ID"].ToString().Trim(),customerNumber); message = message.Replace("[FirstName]",dtCustomer.Rows[0]["FirstName"].ToString().Trim()); message = message.Replace("[LastName]",dtCustomer.Rows[0]["LastName"].ToString().Trim()); message = message.Replace("[URL]","<a href=" + url + ">" + url + "</a>"); message = message.Replace("[CustomerNumber]",dtCustomer.Rows[0]["CustomerNumber"].ToString().Trim()); message = message.Replace("[Password]",dtCustomer.Rows[0]["Password"].ToString().Trim()); EmailUtility utility = new EmailUtility(); utility.FromAddress = fromAddress; utility.ToAddress = toAddress; utility.Subject = subject; utility.Message = message; utility.Send(); lblMessage.Text = result; ReturnAllControls(); } ReturnAllControls(); } catch(Exception ex) { Response.Redirect("printexception.aspx?appname=" + "PremierSurveyCustomerArea" + "&pagename=Signup" + "&eventname=btnAddCustomer_Click" + "&msg=" + ex.Message,false); } }
Thanks.




Reply With Quote