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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:03:58+00:00 2026-06-05T06:03:58+00:00

I understand that a static member will be shared by all users of an

  • 0

I understand that a static member will be shared by all users of an ASP.NET website; but in this particular case – that’s exactly what I want.

It’s a private-use webpage I threw together to facilitate web-based chatting between two users. I wanted to avoid persisting data to a database or a datafile, and thought I could store the last X messages in a static concurrent queue. This seems to work great on my development machine.

I’m very inexperienced with ASP.NET, but in all of the examples I’ve found, none use this approach. Is this a bad-practice, are there ‘gotchas’ I should be aware of? The alternative, that I can see, is to use a database. But I felt like it would be more effort and, my guess, is more resources (I figure my ‘buffer’ of messages will take about 40kb of memory and save quite a few trips to the database).

  • 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-05T06:03:59+00:00Added an answer on June 5, 2026 at 6:03 am

    This is perfectly fine as long as your requirements don’t change and you are OK with randomly loosing all messages on server side.

    I would slightly refactor code to provide “message storage” interface to simplify testing of the code (with potential benefit in the future if you decide to make it more complicated/persisted/multi-user).

    Pro of the static storage approach (or HttpApplicationState):

    • no issues with server side storage of the messages – less privacy concerns. Nothing is stored forever so you can say whatever you want.
    • extremely simple implementation.
    • perfect for IM / phone conversation.
    • unlikely to have performance problems in single server case

    Cons:

    • messages can be lost. Can be mitigated by storing history on the client (i.e. retrieving message with AJAX queries on the same web page)
    • require more care if data is sensitive when more users are involved/or application is shared with some other code as static data is visible to everyone. Also not much different from any other storage.
    • Can’t be directly migrated to multiple servers/web garden scenario. Really unlikely issue for 2 person chat server.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that this a very noob problem, but when I try to create
I understand that this may not necessarily apply to just @properties, but they would
I understand that one benefit of having static member functions is not having to
I know how to initialize a static member that's not an integer, but I'm
I understand that static method inheritance is not supported in C#. I have also
I understand that dynamic/static polymorphism depends on the application design and requirements. However, is
I understand that this is a bad idea for lots of scenarios. I am
I understand that there may be other questions regarding vanity urls but everyone i
I understand that you are not allowed to make cross domain Ajax calls, but
I have class instantiated in a web service that, in a static member, holds

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.