2016-11-16 5 views
0

コントローラリダイレクトアクションに404

 [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

は、あなたがより多くの詳細をご提供できます解決しましたか?たぶんログ? – Sid

+0

私はhttp:// localhost:64765/Mail/Send?theNumber = 2コントローラーはMailControllerと呼ばれています。 – user2620804

+0

デバッガーを使ってみましたか? – Sid

答えて

-1

チェックを属性を持ちます。 であり、機能のために[HTTPPOST]を使用する必要があります。
例:[HTTPGET]を使用して

[HTTPPOST] 
 
public ActionResult Send(int number) 
 
{ 
 
    return RedirectToAction("Send", "Mail", new { theNumber = number }); 
 
}

+0

これは私が持っているものと同じです – user2620804

+0

これは無限ループを引き起こします。 – Sid

+0

soory、[HTTPPOST] public ActionResult Send(int number) { return RedirectToAction( "Send"、 "Mail"、new {theNumber = number}); } –

関連する問題