多個動作我有這樣具有相同動作名稱
public ActionResult Verify(String email, String name){
ViewBag.email = email;
ViewBag.name = name;
return View();
}
[HttpGet]
public ActionResult Verify(String uId){
User user = TippNett.Core.User.Get(uId);
user.Active = true;
user.Save();
Auth.Authenticate(user, false);
return RedirectToAction("Index", "Home");
}
在我的控制器的多個動作的第一個動作是,當用戶註冊,以顯示他的註冊消息,請驗證電子郵件和我打電話像此
return RedirectToAction("Verify", "Account", new { email = email, name = user.FirstName});
當用戶單擊驗證鏈接時會調用第二個操作。 問題在於下面的函數總是被調用。即使我通過電子郵件和名稱作爲參數。
任何人都可以解釋爲什麼會發生這種情況,並可能解決這個問題?
解決方法:使用不同的名稱! – DavidG 2015-02-09 13:21:11
更好看看這個http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx/ – 2015-02-09 13:21:31