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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:40:50+00:00 2026-05-23T01:40:50+00:00

I’ve recently started working on a web app with a new company and found

  • 0

I’ve recently started working on a web app with a new company and found that the session object is used pretty much all the time to hold everything. Often it’s used to pass data between pages instead of using the query string or ViewState.

Other times it’s used it to cache datatables so they’re not requested from the DB a second time.

Basically, any time data needs to be stored, a session is used.

This is pretty much the exact opposite of what I do. If it looks like a session variable is needed, I’ll rethink my design, or maybe sacrifice some efficiency (i.e. reload the data from the databse, rather than store it in a session).

I’m actually thinking that we should always wrap our session objects as Singletons or something to ensure they’re not overly used.

My argument is that Session items are really global variables, so if you find yourself using it to pass data around whenever you feel like it, you’re making the page tightly coupled with other pages, bcause they rely on some other page setting the value.

Also, you can never rely on the data coming through being correct, as another page may have changed it in the intrim, ie: Session[“Id”] on one page might accidentally get overidden by a Session[“Id”] in another browser tab.

There are actually lots of other reasons I think of as well, but can anyone confirm this for me?

Most sites/forums I’ve found recommend people use the session as much as they feel like, to store anything. I’d expect it would be discouraged.

Does anyone know of a best practice that’s generally accepted?

  • 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-23T01:40:51+00:00Added an answer on May 23, 2026 at 1:40 am

    Nothing is wrong with the session if you want to use it and use it in an effective manner. Just like any other technology it can be misused and its up to you to ‘cleanly’ use it a properly architected manner (ideally centralized session access as well)

    You said: “My argument is that Session items are really global variables, so if you find yourself using it to pass data around whenever you feel like it, you’re making the page tightly coupled with other pages, bcause they rely on some other page setting the value. “

    Who said its only for page data? I would be more inclined to use it for session data – such as user specific information that maybe one doesn’t want to serialize out to a forms auth ticket. Using the session in this case is actually better for performance as locking the collection is generally a less expensive operation than the ticket decryption that occurs.

    Create a centralized place to use these values. If you need to use it to pass data between pages – then I would consider a better approach – such as posting or querystring or headers or other context information – or… etc etc.

    Remember you can misuse almost anything in technology. Sessions can be used wisely and I’ve seen plenty of applications do it. It’s up to you.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.