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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:37:13+00:00 2026-06-19T01:37:13+00:00

In our ASP.NET Web Application, we have a service with a life-time/scope that can

  • 0

In our ASP.NET Web Application, we have a service with a life-time/scope that can described as “instance per request” i.e. the instance is stored in the HttpContext.Current.Items collection.

We have had this intermittent issue where the HttpContext.Current property is null during calls from the ASP.NET ReportViewer control. Sometimes it is null, sometimes it is not. The behaviour can be different on the staging website versus a dev machine, and even varies between different dev machines.

This will cause a report which would like to use our service to throw an exception.

Why is the HttpContext.Current property null?

Why is it intermittent?

  • 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-19T01:37:14+00:00Added an answer on June 19, 2026 at 1:37 am

    The source of the problem seems to be that the Report Viewer sometimes uses Thread Pool threads to retrieve data for DataSets defined in the report. Thread Pool threads cannot access the HttpContext.Current instance of the thread servicing the HTTP request (more information in this blog post).

    The reports in my scenario had a number of DataSets in the report definition which each corresponded to an ObjectDataSource defined on the page. After extensive debugging I found that the report would retrieve the data for the first DataSet declared in the report definition on the same thread that services the HTTP request. Any subsequent DataSets would either be retrieved on the main HTTP request thread or a Thread Pool thread. These subsequent DataSets would then intermittently throw exceptions saying that HttpContext.Current was null.

    There does not seem to be any way to predict or control what thread a DataSet will be retrieved on after the first one.

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

Sidebar

Related Questions

We have an ASP.NET web application that we offer as a Service (it's hosted
We have an ASMX web service which we invoke from our ASP.NET application using
I have a web application (ASP.NET/C#) that our clients' employees use, and one of
I've got an ASP.NET web application, that is essentially our intranet site. I made
I have clients that use our web site (asp.net) that they have to be
I have an ASP.NET web application that calls a .NET DLL, that in turn
I have an ASP.NET application which talks to a third-party SOAP web service. My
I have a Performance Problem with our ASP.NET web application and don't know where
We have Flex applications that connect to our ASP.NET 3.5 Web Applications and usually
I have an existing ASP.NET 2.0 web service serves several WinForms clients. In our

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.