控制器
[HttpPost]
public ActionResult Index(string Name, int number)
{
Stored stored = new Stored();
var isValid = from c in _db.stored
where (c.Name == Name && c.Id == number)
select c;
if (isValid.Count() > 0)
{
return View("Index");
}
else if (isValid.Count() > 0 && c.hasExpired)
{
return RedirectToAction("Send", "Mail", new { theNumber = number });
}
else
{
return View("Index");
}
}
目标班级
[HttpPost]
public ActionResult Send(int number)
两者都有HTTP Post属性
答案 0 :(得分:1)
使用[HttpGet]解决了问题
答案 1 :(得分:-1)
从控制器名称检查; 你需要在函数中使用[HTTPPOST] 例如:
[HTTPPOST]
public ActionResult Send(int number)
{
return RedirectToAction("Send", "Mail", new { theNumber = number });
}