Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:01:47+00:00 2026-06-17T08:01:47+00:00

I recently started working on a multi-file upload HTTP page for a customer. He

  • 0

I recently started working on a multi-file upload HTTP page for a customer.

He wants it all in HTTP, Javascript and HTML, needs to be able to transmit large files (up to 800 megabytes each), and he also wants a progressbar for the uploads. Flash or Silverlight is not an accepted option and finally, third-party components are not accepted either, since tight customizability deep down is needed without too much hassle.

Now, I get the whole concept. You have a main page which has an iframe (ewww, I said the i-word – I know). This iframe points to a form which has the file upload in it. This way, once this form is submitted, the original page that the visitor is on won’t reload, allowing the original page to run some AJAX, constantly asking what the progress of the transfer is.

First attempts

I first started out fetching a file in MVC by declaring it directly as a parameter to the action method, as shown below.

public ActionResult UploadFile(HttpPostedFile upload) {
    ...
}

But as great as this help MVC is giving me is, neither the InputStream property or the SaveAs(...) method on the upload variable helped me.

BeginExecute and GetBufferedInputStream

Quickly I found a method introduced in .NET 4.0 called HttpRequest.GetBufferedInputStream(). This method in particular allowed me to receive the file-stream and read it incrementally and asynchronously.

I overwrote the BeginExecute method of my controller, and put the reading functionality in there, when a specific URL was triggered, like this.

protected override IAsyncResult BeginExecute(System.Web.Routing.RequestContext requestContext, AsyncCallback callback, object state)
{
    if (requestContext.HttpContext.Request.Url.AbsolutePath.StartsWith("/Home/UploadFile"))
    {
        //we're doing a file upload
        var streamSource = requestContext.HttpContext.Request.GetBufferedInputStream();

        //read from stream, write to file
    }
}

This all works just fine… When AJAX doesn’t go in and interrupt. You see, if I have my AJAX script running (which executes 10 seconds after the iframe upload has started), then (when it makes its GET request) that request interrupts the stream that is reading the file, even though it is on a different action, and even when it is on a different controller.

The error I am receiving is the following:

The client is disconnected because the underlying request has been completed. There is no longer an HttpContext available.

What can I do about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:01:49+00:00Added an answer on June 17, 2026 at 8:01 am

    Take a look at ASP .NET Ajax File Upload. This should clarify how the GetBufferlessInputStream and GetBufferedInputStream works and how you can use them for an “ajax” file upload, but will force you to change a lot of code.

    If you are using .NET 4.5, an updated version of the project that uses GetBufferedInputStream will come soon and it will be easy to use. You can check the same link for updates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started working with a client that had an index.html file with this
I recently started working with rails 3. I'm trying to add a multi-modal form
I've recently started working with multi-threaded Winform applications and have run up against a
I recently started working with MVC or MVC2 to be more exact. I found
I've recently started working with an application written using Adobe Flex 3. We're using
I`m an Android developer, and recently started working on JAVA PC project for client.
This is a very elementary I realize, I have recently started working with asp.net
I started working on CodeIgniter recently and I'm having some issues with the .htaccess
I recently started using rspec and factory_girl and I'm working on a basic control
I recently started learning Objective-C, and I am working on an iOS app as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.