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
  1. Home
  2. Web Development
  3. ASP.NET
  4. sessions in a class

sessions in a class

Scheduled Pinned Locked Moved ASP.NET
question
5 Posts 5 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.
  • I Offline
    I Offline
    imsathy
    wrote on last edited by
    #1

    i can access a session variable in a class ..... but i cant assign values to it nor i can create a session variable in a class :confused: is there a way?????? thanx in advance sathy

    G A N 3 Replies Last reply
    0
    • I imsathy

      i can access a session variable in a class ..... but i cant assign values to it nor i can create a session variable in a class :confused: is there a way?????? thanx in advance sathy

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      What do you mean when you say that you "cant" do those things? Do you get an error message? --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • I imsathy

        i can access a session variable in a class ..... but i cant assign values to it nor i can create a session variable in a class :confused: is there a way?????? thanx in advance sathy

        A Offline
        A Offline
        Albert Pascual
        wrote on last edited by
        #3

        Session[] is part of System.Web.HttpContext.Current Creating a class won't be part of PAGE, you need to pass the System.Web.HttpContext.Current to work Al My eMail control My Blog

        J 1 Reply Last reply
        0
        • I imsathy

          i can access a session variable in a class ..... but i cant assign values to it nor i can create a session variable in a class :confused: is there a way?????? thanx in advance sathy

          N Offline
          N Offline
          Nitin1981
          wrote on last edited by
          #4

          Try HttpContext.Current.Session["var"] Hope it will solve ur problem.

          1 Reply Last reply
          0
          • A Albert Pascual

            Session[] is part of System.Web.HttpContext.Current Creating a class won't be part of PAGE, you need to pass the System.Web.HttpContext.Current to work Al My eMail control My Blog

            J Offline
            J Offline
            J4amieC
            wrote on last edited by
            #5

            Albert Pascual wrote:

            you need to pass the System.Web.HttpContext.Current to work

            No, you dont as this is essentially a Singleton instance that can be accessed from anywhere. In a class file: System.Web.HttpContext.Current.Session["MySession"] = "Something" Current blacklist svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

            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