我有一個表單上傳文件,服務器必須處理一個需要幾分鐘的大型操作。設置表單發佈超時
我的代碼:
.cshtml:
@using (Html.BeginForm("MyAction", "MyController", FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
<input type="file" name="file"/>
<input type="submit" value="submit" />
}
控制器:
[HttpPost]
public ActionResult MyAction(HttpPostedFileBase file)
{
// Process a large operation here.
return View();
}
我知道這是可能的web.config configuration與server code做到這一點。
我的問題:是否可以使用客戶端配置?
我要求使用XMLHttpRequest
像jQuery.ajax
其可能的情況下設置超時,因爲這樣纔有可能在HTML表單標籤或什麼呢?
可能重複http://stackoverflow.com/questions/579523/how-do-i- set-the-request-timeout-for-one-controller-action-in-an-asp-net-mvc-app) – musefan
我更新了這個問題。這種重複現在不可用了。 –
爲什麼從你的視圖代碼中設置它很重要?爲什麼不能修改控制器代碼? – musefan