【发布时间】:2015-09-15 15:21:54
【问题描述】:
我有一个上传文件的表单,服务器必须处理需要几分钟的大型操作。
我的代码:
.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 表单标签或其他东西中做吗?
【问题讨论】:
-
我更新了这个问题。此副本不再可用。
-
为什么在视图代码中设置它如此重要?为什么不能修改控制器代码?
标签: c# asp.net-mvc asp.net-mvc-4