我不會有一個視圖叫做Test
。但是,在Home
控制器Test
中有一個方法。未創建的視圖會顯示
一切工作正常,Test
方法得到執行並重定向到代碼中給出的Index
視圖。但是,在瀏覽器中,URL是../Home/Test
而不是../Home/Index
。我沒有一個名爲Test
的視圖,爲什麼會顯示?我不希望這個URL在瀏覽器中顯示。我該如何解決這個問題?
查看:
@using (Html.BeginForm("Test", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
..// Other code
}
C#
public ActionResult Test(HttpPostedFileBase f)
{
var m = new HomeModel();
..// Other code goes here
return View("../Home/Index", m); // Will be returning the Index View
}
嘗試'返回視圖(「指數」,男);' – 2013-02-28 09:21:01
謝謝你,我用你的方法 – 2013-02-28 09:54:30