Setting Session within Method?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thdevdex

    #1

    Setting Session within Method?

    Needless to say I'm new to .Net. I'm trying to set Session variables
    from within a method within a class.

    (Name "Session" is not declared) is the message I get while typing in
    the code. I don't get this while entering code within an .aspx.vb file.
    Obviously I need to create and instance of some System.Web... object but
    I don't know what it is. Any ideas?

    Also by setting session variables from within the class and not sending
    back values by properties, is this breaking some object oriented
    concept?



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Steve C. Orr, MCSD

    #2
    Re: Setting Session within Method?

    Simply use the full namespace from within your class:
    System.Web.Http Context.Current .Session

    --
    I hope this helps,
    Steve C. Orr, MCSD

    Developer for Hire


    "thdevdex" <thdevdex@dbcod ers.com> wrote in message
    news:%23oc4zzdZ DHA.2256@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > Needless to say I'm new to .Net. I'm trying to set Session variables
    > from within a method within a class.
    >
    > (Name "Session" is not declared) is the message I get while typing in
    > the code. I don't get this while entering code within an .aspx.vb file.
    > Obviously I need to create and instance of some System.Web... object but
    > I don't know what it is. Any ideas?
    >
    > Also by setting session variables from within the class and not sending
    > back values by properties, is this breaking some object oriented
    > concept?
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Steve C. Orr, MCSD

      #3
      Re: Setting Session within Method?

      Simply use the full namespace from within your class:
      System.Web.Http Context.Current .Session

      --
      I hope this helps,
      Steve C. Orr, MCSD

      Developer for Hire


      "thdevdex" <thdevdex@dbcod ers.com> wrote in message
      news:%23oc4zzdZ DHA.2256@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      > Needless to say I'm new to .Net. I'm trying to set Session variables
      > from within a method within a class.
      >
      > (Name "Session" is not declared) is the message I get while typing in
      > the code. I don't get this while entering code within an .aspx.vb file.
      > Obviously I need to create and instance of some System.Web... object but
      > I don't know what it is. Any ideas?
      >
      > Also by setting session variables from within the class and not sending
      > back values by properties, is this breaking some object oriented
      > concept?
      >
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]


      Comment

      • thdevdex

        #4
        Re: Setting Session within Method?

        I added that and it works fine, thanks. One more question.

        I normally try to get answers from the VS2003 documentation and when I
        was researching which object to use, the documentation for Session was
        yapping about the HttpSessionStat e object. Is there a recommended area
        within the documentation to figure out the appropriate system objects to
        use and when?



        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • thdevdex

          #5
          Re: Setting Session within Method?

          I added that and it works fine, thanks. One more question.

          I normally try to get answers from the VS2003 documentation and when I
          was researching which object to use, the documentation for Session was
          yapping about the HttpSessionStat e object. Is there a recommended area
          within the documentation to figure out the appropriate system objects to
          use and when?



          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          Working...