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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:51:40+00:00 2026-06-12T17:51:40+00:00

I would like to have a user message available for every request sent back

  • 0

I would like to have a “user message” available for every request sent back by the server. If there is not a user message, the message goes back blank. If there is one, an icon is activated on each user screen after their request is completed.

[edit]
The “user message” is something that is being set by an administrator for the application I’m deploying. The administrator can enter text into a field and click a button to send this message to every other user of the system. Any time another user performs any kind of action, the current user message is attached to the JSON response and handled by the front end.

In order to optimize this, I want the message to be stored in memory (not in the database).

I have tried to use static. I have tried to use HttpApplicationState. In both cases, the value of the user message is “blanked out” after some period of time. After some research, it appears that both statics and HttpApplicationState are subject to IIS and when it decides to recycle the application pool. (or some such)

This volatility of a static is mysterious: it should be static – so long as IIS itself lives, this variable should live. It should not be dependent on some kind of “reset” or whatever. The HttpApplicationState is some other situation that I don’t fully understand.

I would like a way to store a value in a non-volatile variable that I can rely on. If I set this value today, it should be there tomorrow, or next week, so long as IIS is not stopped and restarted.

Any help?


here is what i have done to solve the problem as per the accepted answer below:

  1. the user message is a sometime thing. so when the message gets set by some administrator, store the response in the database at that point in time and store it in the Application[“UserMessage”] object.
  2. when round-trips from users come in, the in-memory text for the user message gets added to the json return value.
  3. the message can be cleared by the administrator at any time, which clears both the in-memory message and the database field.
  4. when IIS decides enough is enough and recycles the application, the Application_Start() method (among other tasks) will also re-seed the user message from the database value that was stored when the user message was set (as per step 1).

now the application works as expected. no extra price is paid going to the database for every user request into the system – the user message always comes from memory. in addition to this, the database is updated or loaded for the user message very few times.

  • 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-12T17:51:41+00:00Added an answer on June 12, 2026 at 5:51 pm

    Application cache is a good place for it. The problem for you is, you think you cannot rely on it. Please see the later part of my answer where you will find how to make sure that the value is always there even if after iis restarts or iis recycles your application.

    You can store the value in application cache. It can be done as follows

    Application.Add(name,object)
    

    Later you can retrieve it in each request by using this code

    Application[name]
    

    It works like session but the only difference is it is application wide and all the request from all user will get it. When you first time assign set the value, store it in db as well as application cache so that you can later make a query from db and store it in application cache if value is not there and then retrieve it from application cache.

    You should restore the application cache from the database on Application_Start() event which fires every time the application starts or restarts. This way you can ensure that it is always in the application cache.

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

Sidebar

Related Questions

We have a customer that would like to modify application user messages that we
Still an iphone dev starter but trying. I would like to have the user
I would like to have the page on user/sidebar on the right in the
I would like to have a text field that a user can enter a
I would like to have a checkbox preference that takes the user to a
I currently have two Backbone models: user and project. I would like to have
I would like to make my user control have invisible areas like the areas
I have a MySQL user added to a database that I would like to
I have two tables user and log. I would like to join the user
I would like to make my own user-mode NAT application. I have the folowing

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.