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. Session name

Session name

Scheduled Pinned Locked Moved ASP.NET
helpquestion
7 Posts 5 Posters 1 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.
  • M Offline
    M Offline
    michael_jhons
    wrote on last edited by
    #1

    hello, is there a way to get the session name?,i'm adding a new form page to a website all know is that for exemple session[0]='someString'. can i get the name of the session for exemple "HelloWorld", as session["HelloWorld"]='someString'. thank you for your help

    P N Steve EcholsS 3 Replies Last reply
    0
    • M michael_jhons

      hello, is there a way to get the session name?,i'm adding a new form page to a website all know is that for exemple session[0]='someString'. can i get the name of the session for exemple "HelloWorld", as session["HelloWorld"]='someString'. thank you for your help

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Can you be a little more clear?

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      1 Reply Last reply
      0
      • M michael_jhons

        hello, is there a way to get the session name?,i'm adding a new form page to a website all know is that for exemple session[0]='someString'. can i get the name of the session for exemple "HelloWorld", as session["HelloWorld"]='someString'. thank you for your help

        N Offline
        N Offline
        NeverHeardOfMe
        wrote on last edited by
        #3

        As Paul said, you're not being very clear - however I think this may point you in the direction you want to go.... Dim instance As HttpSessionState = HttpContext.Current.Session Dim value As NameObjectCollectionBase.KeysCollection = instance.Keys Dim key As String For Each key In value Response.Write("Session(""" & key & """) = " & CStr(Session(key)) & "
        ") Next (You will need to amend this if any of your session variables contain values that can't be converted to strings...)

        M 1 Reply Last reply
        0
        • M michael_jhons

          hello, is there a way to get the session name?,i'm adding a new form page to a website all know is that for exemple session[0]='someString'. can i get the name of the session for exemple "HelloWorld", as session["HelloWorld"]='someString'. thank you for your help

          Steve EcholsS Offline
          Steve EcholsS Offline
          Steve Echols
          wrote on last edited by
          #4

          You can get what's put into session: Session["HelloWorld"] = "Hello, my name is Tim."; Response.Write(Session("HelloWorld")); You should see "Hello, my name is Tim." Or are you asking about enumerating the Session collection?


          - S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!

          • S
            50 cups of coffee and you know it's on!
            Code, follow, or get out of the way.
          1 Reply Last reply
          0
          • N NeverHeardOfMe

            As Paul said, you're not being very clear - however I think this may point you in the direction you want to go.... Dim instance As HttpSessionState = HttpContext.Current.Session Dim value As NameObjectCollectionBase.KeysCollection = instance.Keys Dim key As String For Each key In value Response.Write("Session(""" & key & """) = " & CStr(Session(key)) & "
            ") Next (You will need to amend this if any of your session variables contain values that can't be converted to strings...)

            M Offline
            M Offline
            michael_jhons
            wrote on last edited by
            #5

            Dear phil, first of all thank you for your answer, i'm developing a form using (c# asp.net) and i'm adding it to anexisting website which i don't have the source code. all i could get are the session without their names. so i have session[0]='159900' but i don't know its name hope i'm now a little bit more clear. thank you for your help

            S 1 Reply Last reply
            0
            • M michael_jhons

              Dear phil, first of all thank you for your answer, i'm developing a form using (c# asp.net) and i'm adding it to anexisting website which i don't have the source code. all i could get are the session without their names. so i have session[0]='159900' but i don't know its name hope i'm now a little bit more clear. thank you for your help

              S Offline
              S Offline
              Sandeep Akhare
              wrote on last edited by
              #6

              How are you adding to Session ? If you are adding ussing index then you should retrive in same way (providing the same index) If you are giving a name(as key) while adding but while retriving you don't have that name then you can't get as there might gave n number of key value pairs in the Session By the way why you want to retrive the name from session ? Session.Keys will return all the Keys (name) stored in that session

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog

              M 1 Reply Last reply
              0
              • S Sandeep Akhare

                How are you adding to Session ? If you are adding ussing index then you should retrive in same way (providing the same index) If you are giving a name(as key) while adding but while retriving you don't have that name then you can't get as there might gave n number of key value pairs in the Session By the way why you want to retrive the name from session ? Session.Keys will return all the Keys (name) stored in that session

                Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog

                M Offline
                M Offline
                michael_jhons
                wrote on last edited by
                #7

                thank you a lot the last world you said was the answer

                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