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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:35:20+00:00 2026-06-07T02:35:20+00:00

Suppose I were to have a web application and a view called innerPage for

  • 0

Suppose I were to have a web application and a view called innerPage for the application who’s model looks something like this:

public class innerPageModel
{
    public bool isFirstTime = true;
    public List<int> threadIDList;


}

And here is the controller for my innerPage:

public ActionResult innerPage(InnerPageModel model)
{
   if (model.isFirstTime == true)
   {
       Thread t = new Thread(Work);
       model.threadIDList.Add(t.ManagedThreadID);
       model.isFirstTime = false);

   } 
   System.Diagnostics.Debug.Write((model.threadIDList.Count).toString());
}

Now my innerPage view is being refreshed every 5 seconds and therefore traversing my innerPage controller each time. The problem is that all of the data in my model is being reset after every time I traverse the controller (Everytime it goes inside the if-block, indicating that model.isFirstTime is being reset to true when I only want to traverse that if-block on the first time). Likewise, my model.threadIDList is being reset everytime through.

Is there a way for me to save the data in my model such that it isn’t lost everytime my view refreshes?

  • 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-07T02:35:21+00:00Added an answer on June 7, 2026 at 2:35 am

    The MVC model assumes the controller will be invoked, return an ActionResult and then be done.

    It does not seem safe to kick off threads in the controller action.

    If you need data to remain between HTTP requests, you can store it in the Session or in Cache, depending on whether the data is per-user or global to the website.

    If you need true background processing, look at

    • WebBackgrounder
    • Quartz.NET
    • FluentScheduler
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application I have an application design that looks like this: web application layer
Suppose that you have a big Data Entry Web Application Like Microsoft CRM ,
Suppose I have 2 models Public class Bus extends Model{ @OneToMany(mappedBy=bus) private List<Passenger> passengers;
Suppose I have: public class foobar { public int lorem; public int ipsum; }
Suppose you have the following... An ASP.NET web application that calls a stored procedure
I have developed a java 1.4 web application.Application is deployed on jboss(tomcat). suppose my
Suppose I have a web application with some basic functions. I want to market
Suppose you have a single web portal application that is used by a number
Suppose I have logged into an web application. I'm on the page Default.aspx. If
Suppose you have two seperate ASP.NET Web Application projects that both need to use

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.