Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Grouping session variables

Grouping session variables

Scheduled Pinned Locked Moved ASP.NET
htmlquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    firestoper
    wrote on last edited by
    #1

    Hi Guru's I'm not good at organizing my sessions and I always find my self scratching my head when ever I'm looking from session variable I created. Is there any technique / way that I could organize my sessions into one holder, hmm something like what Enum can do? I always port my session variables this way Session("memberID") = memberID Session("memberName")= memberName Session("memberEmail")= memberEmail is there a way that I could group then and place the group to a session? like placing Enum into session, hmm but not that actually but the idea of placing it. e.g. Public Enum MemberInfo memberID = 1 memberName = "Name" end Enum Session("memberInfo")= memberIfo regards Dom

    P 1 Reply Last reply
    0
    • F firestoper

      Hi Guru's I'm not good at organizing my sessions and I always find my self scratching my head when ever I'm looking from session variable I created. Is there any technique / way that I could organize my sessions into one holder, hmm something like what Enum can do? I always port my session variables this way Session("memberID") = memberID Session("memberName")= memberName Session("memberEmail")= memberEmail is there a way that I could group then and place the group to a session? like placing Enum into session, hmm but not that actually but the idea of placing it. e.g. Public Enum MemberInfo memberID = 1 memberName = "Name" end Enum Session("memberInfo")= memberIfo regards Dom

      P Offline
      P Offline
      petersgyoung
      wrote on last edited by
      #2

      Your thinking is very near but Enum cannot work. You should create a Class. Storing your MemberInfo Class to session is: Dim m_memberInfo As New MemberInfo m_memberInfo.memberID=1 m_memberInfo.memberName="Name" Session("memberInfo")=m_memberInfo Retrieving data from Session is: m_memberInfo=DirectCast(Session("memberInfo"))

      F 1 Reply Last reply
      0
      • P petersgyoung

        Your thinking is very near but Enum cannot work. You should create a Class. Storing your MemberInfo Class to session is: Dim m_memberInfo As New MemberInfo m_memberInfo.memberID=1 m_memberInfo.memberName="Name" Session("memberInfo")=m_memberInfo Retrieving data from Session is: m_memberInfo=DirectCast(Session("memberInfo"))

        F Offline
        F Offline
        firestoper
        wrote on last edited by
        #3

        Thanks, that would be a great idea.. hmm but are there any other object which I could explicitly group my session variable on the fly without creating another class? Dom

        F 1 Reply Last reply
        0
        • F firestoper

          Thanks, that would be a great idea.. hmm but are there any other object which I could explicitly group my session variable on the fly without creating another class? Dom

          F Offline
          F Offline
          firestoper
          wrote on last edited by
          #4

          Also was it a good practice to place class into a sessions? Regards Dom

          P 1 Reply Last reply
          0
          • F firestoper

            Also was it a good practice to place class into a sessions? Regards Dom

            P Offline
            P Offline
            petersgyoung
            wrote on last edited by
            #5

            Where possible, you should avoid putting large objects in session because they will eat up server memory. You also need to pay special attention if your web application is on a web farm. petersgyoung

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups