1

在我的 MVC4 项目中,我有一个布局视图,其中的表单发布ContactFormHomeController.

@using (Html.BeginForm("ContactForm", "Home", FormMethod.Post))
{
      --actual form content goes here
   <input id="submit" type="submit" value="SUBMIT" class="pull-right" />
}

在我的ContactForm操作方法中,我再次重定向到Index操作方法,在该方法中我重定向到主页。

[HttpPost]
public ActionResult ContactForm(ContactModel model)
{
    try
    {
       --code goes here
    }
    catch (Exception ex)
    {
       --code goes here
    }
  return Index();
  //return RedirectToAction("Index", "Home");
}

但问题是它没有重定向到主页,而是重定向到ContactForm下面的操作方法HomeController

public ActionResult Index()
{
   return Redirect("www.homepage.com");
}
4

0 回答 0