Session variable and WebServices

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

    #1

    Session variable and WebServices

    Hi,
    I've few problem with Session Variables and WebServices.
    I've a web application (.aspx), and I assign a Session variable ( ex:
    Session.Add("CO D",Value) ). Then I call a WebService. I need that the
    service read the value of the session variable, but if i try i retrive a
    null value.
    Can anyone help me?

    Thanks

    Gvnn


  • BenoitM

    #2
    Re: Session variable and WebServices

    did you set 'EnableSession' to True in the 'WebMethod' attribute ? it's
    false by default ...

    if you want your web service to have it's own session variables you'll have
    to do more work... try to search for 'WebMethodAttri bute.EnableSess ion
    Property' in MSDN Library (or http://msdn.microsoft.com) for a starting
    point

    hope it helps

    "Gvnn" <gvnnsuperstar@ hotmail.com> wrote in message
    news:9dPTa.2792 $w8.2450@news.e disontel.com...[color=blue]
    > Hi,
    > I've few problem with Session Variables and WebServices.
    > I've a web application (.aspx), and I assign a Session variable ( ex:
    > Session.Add("CO D",Value) ). Then I call a WebService. I need that the
    > service read the value of the session variable, but if i try i retrive a
    > null value.
    > Can anyone help me?
    >
    > Thanks
    >
    > Gvnn
    >
    >[/color]


    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Session variable and WebServices

      Gvnn,

      If you are making the call through a proxy, then the web service is
      going to be assigned a new session id because it considers the ASPX page the
      same as any other client. What you need to do is actually instantiate the
      class that is behind the webservice and call the method directly.

      Hope this helps.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - nicholas.paldin o@exisconsultin g.com

      "Gvnn" <gvnnsuperstar@ hotmail.com> wrote in message
      news:9dPTa.2792 $w8.2450@news.e disontel.com...[color=blue]
      > Hi,
      > I've few problem with Session Variables and WebServices.
      > I've a web application (.aspx), and I assign a Session variable ( ex:
      > Session.Add("CO D",Value) ). Then I call a WebService. I need that the
      > service read the value of the session variable, but if i try i retrive a
      > null value.
      > Can anyone help me?
      >
      > Thanks
      >
      > Gvnn
      >
      >[/color]


      Comment

      Working...