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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:31:16+00:00 2026-05-26T15:31:16+00:00

I have an ASP.NET MVC 3 (.NET 4) web application. This app fetches data

  • 0

I have an ASP.NET MVC 3 (.NET 4) web application.

This app fetches data from an Oracle database and mixes some information with another Sql Database.
Many tables are joined together and lot of database reading is involved.
I have already optimized the best I could the fetching side and I don’t have problems with that.
I’ve use caching to save information I don’t need to fetch over and over.

Now I would like to build a responsive interface and my goal is to present the users the order headers filtered, and load the order lines in background.

I want to do that cause I need to manage all the lines (order lines) as a whole cause of some calculations.

What I have done so far is using jQuery to make an Ajax call to my action where I fetch the order headers and save them in a cache (System.Web.Caching.Cache).
When the Ajax call has succeeded I fire off another Ajax call to fetch the lines (and, once again, save the result in a cache).

It works quite well.

Now I was trying to figure out if I can move some of this logic from the client to the server.

When my action is called I want to fetch the order header and start a new thread – responsible of the order lines fetching – and return the result to the client.

In a test app I tried both ThreadPool.QueueUserWorkItem and Task.Factory but I want the generated thread to access my cache.

I’ve put together a test app and done something like this:

TEST 1

[HttpPost]
public JsonResult RunTasks01()
{
    var myCache = System.Web.HttpContext.Current.Cache;
    myCache.Remove("KEY1");

    ThreadPool.QueueUserWorkItem(o => MyFunc(1, 5000000, myCache));

    return (Json(true, JsonRequestBehavior.DenyGet));
}

TEST 2

[HttpPost]
public JsonResult RunTasks02()
{
    var myCache = System.Web.HttpContext.Current.Cache;
    myCache.Remove("KEY1");

    Task.Factory.StartNew(() =>
    {
        MyFunc(1, 5000000, myCache);
    });

    return (Json(true, JsonRequestBehavior.DenyGet));
}

MyFunc crates a list of items and save the result in a cache; pretty silly but it’s just a test.

I would like to know if someone has a better solution or knows of some implications I might have access the cache in a separate thread?!

Is there anything I need to be aware of, I should avoid or I could improve ?

Thanks for your help.

  • 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-05-26T15:31:17+00:00Added an answer on May 26, 2026 at 3:31 pm

    One possible issue I can see with your approach is that System.Web.HttpContext.Current might not be available in a separate thread. As this thread could run later, once the request has finished. I would recommend you using the classes in the System.Runtime.Caching namespace that was introduced in .NET 4.0 instead of the old HttpContext.Cache.

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

Sidebar

Related Questions

I have built an ASP.NET mvc web application and it seems that some of
I have this web app that is running ASP .NET MVC 1.0 with LINQ
I have an ASP.NET MVC 3 / .NET Web Application, which is heavily data-driven,
I have 2 web application projects. One is my asp.net MVC app and the
I have a Asp.net MVC web application, containing mostly text. I want to put
Here's what I'm trying to do. I have an ASP.NET MVC web application, where
I have developed a MVC web application with ASP.NET MVC and im just wondering
I have one question; In my ASP.NET MVC web application have to do certain
I have to migrate a web application I made with ASP.NET MVC to a
I have integrated a Silverlight Navigation Application in an ASP.NET MVC web. However when

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.