我在我的方法中使用了try catch,我得到了这条消息“无法评估表达式,因为代码已经过优化,或者本机框架位于调用堆栈之上。”,但方法执行成功(数据保存在数据库中)。 这是我的代码:
try
{
//saving EmailMoney Table and Transactions Table
string EmailMoneyCode = HelperClasses.Globals.RandomString(20);
LogicLayer.Entities.Transaction NewTransaction = new LogicLayer.Entities.Transaction();
NewTransaction.EmailMoneyTransaction.EmailRecipientID = Convert.ToInt32(ddlRecipients.SelectedValue);
NewTransaction.EmailMoneyTransaction.EmailMoneyGeneratedCode = EmailMoneyCode;
NewTransaction.SourceAccountID = VirtualAccountIDFrom;
NewTransaction.SourceCurrencyID = CurrencyIDFrom;
NewTransaction.SourceAmount = AmountToWithdraw;
NewTransaction.ReceivingAmount = Amount;
NewTransaction.Fee = FeeConverted;
NewTransaction.SubTransactionType = DataLayer.Enums.RefSubTransactionType.EmailTransfer;
NewTransaction.Save();
UpdateVABalance(VirtualAccountIDFrom, AmountToWithdraw);
Response.Redirect("EmailMoney.aspx?notif=1");
}
catch (Exception ex)
{
divNotif.Attributes["class"] = "notibar msgerror";
divNotif.InnerHtml = "<a class=\"close\"></a><p>" + ex.Message + "</p>";
return;
}
我该如何解决这个问题。提前谢谢。
答案 0 :(得分:0)
Response.Redirect(url)
会给您出现此错误Redirect as below with the second argument。
Response.Redirect("EmailMoney.aspx?notif=1",false);