をMVC 4をアップロードバックファイルの後にメッセージでリダイレクトし、アクションビューを呼び出すために戻ってメッセージでリダイレクトしたい:と呼ばれるC#の私はMVC 4アプリケーションに取り組んできました
- 処置:アップロード
- 現在のビュー:インデックス
public class HospitalController: Controller {
public ActionResult Index()
{
return View(Model);
}
[HttpPost]
public ActionResult Index(Model model)
{
return View(ohosDetailFinal);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Upload(HttpPostedFileBase upload,FormCollection form)
{
//Here i want to pass messge after file upload and redirect to index view with message
// return View(); not working
}
}
@using (Html.BeginForm("Upload", "Hospital", null, FormMethod.Post, new { enctype = "multipart/form-data", @class = "" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary()
<input type="file" id="dataFile" name="upload" class="hidden" />
}
ありがとう!
使用 ''リダイレクト、およびクエリ文字列値としてメッセージを渡すか、または 'Tempdata'に入れて取得するために(...)RedirectToActionを返しますそれはGETメソッドで –