1

I have a form that upload a file and the server has to process a large operation that takes several minutes.

My code:

.cshtml:

@using (Html.BeginForm("MyAction", "MyController", FormMethod.Post,
            new { enctype = "multipart/form-data" }))
{
    <input type="file" name="file"/>
    <input type="submit" value="submit" />
}

Controller:

[HttpPost]
public ActionResult MyAction(HttpPostedFileBase file)
{
    // Process a large operation here.

    return View();
}

I know it's possible to do it with web.config configuration and with server code.
My question: Is it possible to do with client side configuration?

I ask that because when using XMLHttpRequest like jQuery.ajax its possible to set the timeout, so is it possible to do in html form tag or something?

3

1 Answer 1

2

One of the options is to create AsyncController and then you can set [AsyncTimeout(xxxx)] or [NoAsyncTimeout] attributes in your action.

Here is an example on how to do it

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer, but I'm trying something with client configuration as jQuery.ajax. +1.
@JonnyPiazzi then you might consider to use jQuery.ajax from your view where you can specify timeout. But I would recommend to use AsyncController

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.