我遇到了visual studio 2013的问题。我的控制器中有两个动作:ActionResult VerifyRequest和ActionResult b。
public ActionResult VerifyRequest()
{
Utility.SessionKeys sessionKeys = new Utility.SessionKeys();
Session.Add(sessionKeys.InvoiceNumber, result.OrderId);
payment.TrackingCode = result.VerifyResultData.SystemTraceNo;
payment.state = 3;
payment.Confirmed = true;
payment.Transactionsuccess = true;
db.Entry(payment).State = EntityState.Modified;
db.SaveChanges();
melliBank.ResCode = result.VerifyResultData.ResCode;
melliBank.OrderId = result.VerifyResultData.OrderId;
melliBank.RetrivalRefNo = result.VerifyResultData.RetrivalRefNo;
melliBank.SystemTraceNo = result.VerifyResultData.SystemTraceNo;
melliBank.InvoiceDate = payment.IssueDate;
melliBank.Succeed = result.VerifyResultData.Succeed;
melliBank.Amount = result.VerifyResultData.Amount;
melliBank.Description = result.VerifyResultData.Description;
melliDB.InsertMelliBankLog(melliBank);
ReservType reserv = db.ReservTypes.Find(payment.ReserveType);
//string url = string.Format("{0}://{1}{2}{3}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"), reserv.ConfirmUrl);
//return Redirect(url);
return RedirectToAction(reserv.ConfirmUrl.Split('/')[1], reserv.ConfirmUrl.Split('/')[0]);
}
public ActionResult b()
{
return View();
}
这是交易: 当我从动作" VerifyRequest"中使用RedirectToAction(" b")时返回行动后的行动b" VerifyRequest"再次执行。并且当动作b完成时,动作" VerifyRequest"再次执行。 我不知道如何解决这个问题,什么是bug。请帮我。 有时" VerifyRequest"重定向后执行4次
答案 0 :(得分:0)
对于RedirectToAction,我们必须传递actionmethod名称 试试这个: -
return RedirectToAction("b);