2

I have used this jQuery plugin for upload a file.

It is working fine with single/multiple files.

But when I try to upload large files like 90 to 100 MB in size, it blocks all other ajax calls.

While uploading such large files if I've minimized the window and I am trying to access other page, all ajax calls will be in queue until upload completes.

There isn't any issue with file upload, I can upload a file upto 2 GB. But I can't access any other functionality of my site until the upload completes.

How can I solve this issue ?

I want to force this upload process to work asynchronously, to let me access all other pages/ functionality of my site.

Is there any other option/plugin available which I an use for this purpose (without Flash) ?

1

1 Answer 1

3

That's normal and expected behavior if you are using ASP.NET Sessions inside your controller. It is by design. The ASP.NET Session is not thread safe and if you attempt to trigger parallel requests from the same session, ASP.NET will simply block and execute the 2 requests sequentially.

If you don't want this behavior you will have to disable sessions for the controller containing the action you are uploading to. This could be done by decorating it with the SessionState attribute:

[SessionState(SessionStateBehavior.Disabled)]
public class SomeController: Controller
{
    // You cannot use Session in this controller

    [HttpPost]
    public ActionResult Upload(MyViewModel model)
    {
        ...
    }
}
Sign up to request clarification or add additional context in comments.

4 Comments

By doing this, how can than we secure the action ?
By using Forms Authentication and the [Authorize] attribute which is the standard way to secure something in ASP.NET MVC.
Getting error if i put SessionState attribute Error 22 Attribute 'SessionState' is not valid on this declaration type. It is only valid on 'class' declarations.
Right, you have to put this attribute on the controller. I will update my answer.

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.