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 8625389
In Process

The Archive Base Latest Questions

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

Using ASP.NET MVC4 I have created a DelegatingHandler in a WebAPI project. I use

  • 0

Using ASP.NET MVC4 I have created a DelegatingHandler in a WebAPI project. I use the Handler to insert some data into the HttpRequestMessage Properties collection so that later portions of the Http pipeline (e.g. other handlers, controllers) can access that data.

Example:

var httpRequest = (HttpRequestMessageProperty) request.Properties["httpRequest"];
httpRequest.Headers["MY_DATA"] = "some data";

I wanted to test the impact of this on the throughput of WebAPI request processing so I created a console app that, within an Action delegate, instantiates an HttpClient, sends a request, and waits for the response before sending the next one. I count the number of successful executions of this Action delegate within a 5 second window using the performance measurement strategy described here:
http://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi

What I have observed is that there is over a magnitude loss in performance in executing the single line that retrieves the httpRequest from the Properties collection. Without this line of code I see >700 completions within 5 seconds. When I add that line in, it drops to <20 completions within 5 seconds.

Has anyone else experienced this? Is there a different method I should use to cache data for the length of a single request that will be available throughout the Http pipeline?

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

    Adding an item to the Current HttpContext Items collection appears to work and has no discernable impact on the performance I am measuring.

    HttpContext.Current.Items.Add(REQUEST_ID_KEY, request.GetCorrelationId().ToString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Single Page Application (ASP.NET MVC4) using Steven Sanderson's instructions .
I have been writing an application using ASP.Net MVC4, where the majority of the
I am working on a project ASP.net 4, MVC4(RC) using visual studio 11. I
I'm using ASP.NET MVC4 (EF Code-first) with WCF ADO.NET Data Service October 2011 CTP.
I have created an application in ASP.NET MVC4 and hosted my application in IIS
After manually upgrading an ASP.NET MVC project to MVC4 using these instructions , how
Using Visual Studio 2012, I created a new ASP.NET MVC 4 web project, using
I have a ASP.NET MVC 4 project with EF. I' m using System.Net.Mail to
I have created a custom attribute in my asp.net MVC application using the following
I am creating a web api using asp.net mvc4 and the response output is

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.