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

  • SEARCH
  • Home
  • 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 8624241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:28:32+00:00 2026-06-12T07:28:32+00:00

I am trying to following this web blog on uploading large files using the

  • 0

I am trying to following this web blog on uploading large files using the Web Api class via Asp.Net Web Forms. If you look through the post you will notice that in order to avoid an out of memory because of buffering of larges files, they recommend overriding the IHostBufferPolicySelector interface. Where do I implement the interface? Do I do it in the Web Api class, in the Global.asax or am I completely off track and need to do the implementation somewhere else?

  • 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-12T07:28:33+00:00Added an answer on June 12, 2026 at 7:28 am

    You don’t need to implement this interface, I only listed it as a reference – that code is already part of Web API source (under System.Web.Http/Hosting/IHostBufferPolicySelector.cs)

    What you need to do is override the base class System.Web.Http.WebHost.WebHostBufferPolicySelector

    This is enough:

    public class NoBufferPolicySelector : WebHostBufferPolicySelector
    {
       public override bool UseBufferedInputStream(object hostContext)
       {
          var context = hostContext as HttpContextBase;
    
          if (context != null)
          {
             if (string.Equals(context.Request.RequestContext.RouteData.Values["controller"].ToString(), "uploading", StringComparison.InvariantCultureIgnoreCase))
                return false;
          }
    
          return true;
       }
    
       public override bool UseBufferedOutputStream(HttpResponseMessage response)
       {
          return base.UseBufferedOutputStream(response);
       }
    }
    

    and then registering your new class in either Global.asax or WebApiConfig.cs (whichever you prefer):

    GlobalConfiguration.Configuration.Services.Replace(typeof(IHostBufferPolicySelector), new NoBufferPolicySelector());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the Facebook assemblies in ASP.NET MVC 3. I'm following this
I'm starting a new web project using ASP.NET Webforms + EF4. I'm trying to
I'm trying to add a route in my web forms application by following this:
I'm trying to use Youtube apis in my web application by following this guide
I am trying to set up Combres on an Asp.Net MVC 3 site following
I am trying to send data to this web service . With the following
I'm trying to consume the following web service http://ipinfodb.com/ip_location_api.php this web service returns an
I'm trying to parse the result from a RESTFull call using RestTemplate following this
I'm trying to build an ASP.NET page that can crawl web pages and display
I've recently taken an existing ASP.NET 3.5 web forms application that was upgraded to

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.