Threading and Session Objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roberto López

    #1

    Threading and Session Objects

    Hi,
    I´m doing an asp.net application that uploads and downloads files and
    folders between the client and the server on my intranet. To do this I have
    create threads and it runs Ok but I need to show to the user the progress of
    the operation and here is the problem. I try to access to the Session
    Variables from inside the thread to show it on a page that automatically
    refresh, BUT, I have discovered that there is no access to the httpcontext
    from inside the new thread. Is there any other way to do this??

    Thanks a lot.

    --
    Roberto López
    Dpto. Soporte Software
    Eurosistemas Informáticos y Comunicaciones, S.L.


  • S. Justin Gengo

    #2
    Re: Threading and Session Objects

    Here's an article:



    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche
    "Roberto López" <rlopez@eurosis temas.net> wrote in message
    news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > Hi,
    > I´m doing an asp.net application that uploads and downloads files and
    > folders between the client and the server on my intranet. To do this I[/color]
    have[color=blue]
    > create threads and it runs Ok but I need to show to the user the progress[/color]
    of[color=blue]
    > the operation and here is the problem. I try to access to the Session
    > Variables from inside the thread to show it on a page that automatically
    > refresh, BUT, I have discovered that there is no access to the httpcontext
    > from inside the new thread. Is there any other way to do this??
    >
    > Thanks a lot.
    >
    > --
    > Roberto López
    > Dpto. Soporte Software
    > Eurosistemas Informáticos y Comunicaciones, S.L.
    >
    >[/color]


    Comment

    • Roberto López

      #3
      Re: Threading and Session Objects

      I just readed this article but, what i need is to access to the session
      object from within a class. And doing it I alwais receive an error.


      "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el mensaje
      news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Here's an article:
      >
      > http://www.ftponline.com/vsm/2002_11...tures/chester/
      >
      > --
      > S. Justin Gengo, MCP
      > Web Developer
      >
      > Free code library at:
      > www.aboutfortunate.com
      >
      > "Out of chaos comes order."
      > Nietzche
      > "Roberto López" <rlopez@eurosis temas.net> wrote in message
      > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..[color=green]
      > > Hi,
      > > I´m doing an asp.net application that uploads and downloads files and
      > > folders between the client and the server on my intranet. To do this I[/color]
      > have[color=green]
      > > create threads and it runs Ok but I need to show to the user the[/color][/color]
      progress[color=blue]
      > of[color=green]
      > > the operation and here is the problem. I try to access to the Session
      > > Variables from inside the thread to show it on a page that automatically
      > > refresh, BUT, I have discovered that there is no access to the[/color][/color]
      httpcontext[color=blue][color=green]
      > > from inside the new thread. Is there any other way to do this??
      > >
      > > Thanks a lot.
      > >
      > > --
      > > Roberto López
      > > Dpto. Soporte Software
      > > Eurosistemas Informáticos y Comunicaciones, S.L.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Roberto López

        #4
        Re: Threading and Session Objects

        The same error appears. For some reason, when the new thread is started from
        a class, the httpcontext is set to null to the thread. If it is done from a
        aspx page there is no error. Why? I don´t know.


        "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el mensaje
        news:#vEL9GqWDH A.536@TK2MSFTNG P10.phx.gbl...[color=blue]
        > How about passing the session object into the class through a public
        > property?
        >
        > --
        > S. Justin Gengo, MCP
        > Web Developer
        >
        > Free code library at:
        > www.aboutfortunate.com
        >
        > "Out of chaos comes order."
        > Nietzche
        > "Roberto López" <rlopez@eurosis temas.net> wrote in message
        > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..[color=green]
        > > I just readed this article but, what i need is to access to the session
        > > object from within a class. And doing it I alwais receive an error.
        > >
        > >
        > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el mensaje
        > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...[color=darkred]
        > > > Here's an article:
        > > >
        > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
        > > >
        > > > --
        > > > S. Justin Gengo, MCP
        > > > Web Developer
        > > >
        > > > Free code library at:
        > > > www.aboutfortunate.com
        > > >
        > > > "Out of chaos comes order."
        > > > Nietzche
        > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
        > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
        > > > > Hi,
        > > > > I´m doing an asp.net application that uploads and downloads files[/color][/color][/color]
        and[color=blue][color=green][color=darkred]
        > > > > folders between the client and the server on my intranet. To do this[/color][/color][/color]
        I[color=blue][color=green][color=darkred]
        > > > have
        > > > > create threads and it runs Ok but I need to show to the user the[/color]
        > > progress[color=darkred]
        > > > of
        > > > > the operation and here is the problem. I try to access to the[/color][/color][/color]
        Session[color=blue][color=green][color=darkred]
        > > > > Variables from inside the thread to show it on a page that[/color][/color]
        > automatically[color=green][color=darkred]
        > > > > refresh, BUT, I have discovered that there is no access to the[/color]
        > > httpcontext[color=darkred]
        > > > > from inside the new thread. Is there any other way to do this??
        > > > >
        > > > > Thanks a lot.
        > > > >
        > > > > --
        > > > > Roberto López
        > > > > Dpto. Soporte Software
        > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
        > > > >
        > > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Roberto López

          #5
          Re: Threading and Session Objects

          I have tryed it too. :-(


          "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
          news:uneo$gqWDH A.2064@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Try HttpContext.Cur rent.Session.
          > --
          > John Saunders
          > Internet Engineer
          > john.saunders@s urfcontrol.com
          >
          > "Roberto López" <rlopez@eurosis temas.net> wrote in message
          > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..[color=green]
          > > I just readed this article but, what i need is to access to the session
          > > object from within a class. And doing it I alwais receive an error.
          > >
          > >
          > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el mensaje
          > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...[color=darkred]
          > > > Here's an article:
          > > >
          > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
          > > >
          > > > --
          > > > S. Justin Gengo, MCP
          > > > Web Developer
          > > >
          > > > Free code library at:
          > > > www.aboutfortunate.com
          > > >
          > > > "Out of chaos comes order."
          > > > Nietzche
          > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
          > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
          > > > > Hi,
          > > > > I´m doing an asp.net application that uploads and downloads files[/color][/color][/color]
          and[color=blue][color=green][color=darkred]
          > > > > folders between the client and the server on my intranet. To do this[/color][/color][/color]
          I[color=blue][color=green][color=darkred]
          > > > have
          > > > > create threads and it runs Ok but I need to show to the user the[/color]
          > > progress[color=darkred]
          > > > of
          > > > > the operation and here is the problem. I try to access to the[/color][/color][/color]
          Session[color=blue][color=green][color=darkred]
          > > > > Variables from inside the thread to show it on a page that[/color][/color]
          > automatically[color=green][color=darkred]
          > > > > refresh, BUT, I have discovered that there is no access to the[/color]
          > > httpcontext[color=darkred]
          > > > > from inside the new thread. Is there any other way to do this??
          > > > >
          > > > > Thanks a lot.
          > > > >
          > > > > --
          > > > > Roberto López
          > > > > Dpto. Soporte Software
          > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • John Saunders

            #6
            Re: Threading and Session Objects

            Perhaps you could supply a reproducer? I don't immediately see why there
            would be a problem passing Page.Context to the new thread before it starts.
            In particular, I can't imagine how, if you passed a non-null HttpContext
            into the thread, it would become null. I can understand how it could become
            invalid, but not how it could become null.
            --
            John Saunders
            Internet Engineer
            john.saunders@s urfcontrol.com

            "Roberto López" <rlopez@eurosis temas.net> wrote in message
            news:eHD7uoqWDH A.2100@TK2MSFTN GP11.phx.gbl...[color=blue]
            > I have tryed it too. :-(
            >
            >
            > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
            > news:uneo$gqWDH A.2064@TK2MSFTN GP11.phx.gbl...[color=green]
            > > Try HttpContext.Cur rent.Session.
            > > --
            > > John Saunders
            > > Internet Engineer
            > > john.saunders@s urfcontrol.com
            > >
            > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
            > > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
            > > > I just readed this article but, what i need is to access to the[/color][/color][/color]
            session[color=blue][color=green][color=darkred]
            > > > object from within a class. And doing it I alwais receive an error.
            > > >
            > > >
            > > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el mensaje
            > > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...
            > > > > Here's an article:
            > > > >
            > > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
            > > > >
            > > > > --
            > > > > S. Justin Gengo, MCP
            > > > > Web Developer
            > > > >
            > > > > Free code library at:
            > > > > www.aboutfortunate.com
            > > > >
            > > > > "Out of chaos comes order."
            > > > > Nietzche
            > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
            > > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
            > > > > > Hi,
            > > > > > I´m doing an asp.net application that uploads and downloads files[/color][/color]
            > and[color=green][color=darkred]
            > > > > > folders between the client and the server on my intranet. To do[/color][/color][/color]
            this[color=blue]
            > I[color=green][color=darkred]
            > > > > have
            > > > > > create threads and it runs Ok but I need to show to the user the
            > > > progress
            > > > > of
            > > > > > the operation and here is the problem. I try to access to the[/color][/color]
            > Session[color=green][color=darkred]
            > > > > > Variables from inside the thread to show it on a page that[/color]
            > > automatically[color=darkred]
            > > > > > refresh, BUT, I have discovered that there is no access to the
            > > > httpcontext
            > > > > > from inside the new thread. Is there any other way to do this??
            > > > > >
            > > > > > Thanks a lot.
            > > > > >
            > > > > > --
            > > > > > Roberto López
            > > > > > Dpto. Soporte Software
            > > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
            > > > > >
            > > > > >
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Roberto López

              #7
              Re: Threading and Session Objects

              The problem is that I not only need to read values from session variables,
              i need to update session variables while the new thread is running, and here
              is the problem. When i try to set a new value to a session variable I
              receive
              the error of HttpContext is a Null Reference.
              I need to store a value into the session variable to read it periodically
              from other
              page to know about the status of the process. I hope you understand me.

              My code is like this:

              public class AccessIO

              public sub New()

              end sub

              public sub CopyFiles()
              ...routine to copy files...
              ...... ..... ... ..


              ...here is the error...
              httpcontext.cur rent.session("P ercentComplete" ) = anyvalue

              end sub

              end class


              "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
              news:Ogl801qWDH A.1644@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Perhaps you could supply a reproducer? I don't immediately see why there
              > would be a problem passing Page.Context to the new thread before it[/color]
              starts.[color=blue]
              > In particular, I can't imagine how, if you passed a non-null HttpContext
              > into the thread, it would become null. I can understand how it could[/color]
              become[color=blue]
              > invalid, but not how it could become null.
              > --
              > John Saunders
              > Internet Engineer
              > john.saunders@s urfcontrol.com
              >
              > "Roberto López" <rlopez@eurosis temas.net> wrote in message
              > news:eHD7uoqWDH A.2100@TK2MSFTN GP11.phx.gbl...[color=green]
              > > I have tryed it too. :-(
              > >
              > >
              > > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
              > > news:uneo$gqWDH A.2064@TK2MSFTN GP11.phx.gbl...[color=darkred]
              > > > Try HttpContext.Cur rent.Session.
              > > > --
              > > > John Saunders
              > > > Internet Engineer
              > > > john.saunders@s urfcontrol.com
              > > >
              > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
              > > > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..
              > > > > I just readed this article but, what i need is to access to the[/color][/color]
              > session[color=green][color=darkred]
              > > > > object from within a class. And doing it I alwais receive an error.
              > > > >
              > > > >
              > > > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el[/color][/color][/color]
              mensaje[color=blue][color=green][color=darkred]
              > > > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...
              > > > > > Here's an article:
              > > > > >
              > > > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
              > > > > >
              > > > > > --
              > > > > > S. Justin Gengo, MCP
              > > > > > Web Developer
              > > > > >
              > > > > > Free code library at:
              > > > > > www.aboutfortunate.com
              > > > > >
              > > > > > "Out of chaos comes order."
              > > > > > Nietzche
              > > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
              > > > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
              > > > > > > Hi,
              > > > > > > I´m doing an asp.net application that uploads and downloads[/color][/color][/color]
              files[color=blue][color=green]
              > > and[color=darkred]
              > > > > > > folders between the client and the server on my intranet. To do[/color][/color]
              > this[color=green]
              > > I[color=darkred]
              > > > > > have
              > > > > > > create threads and it runs Ok but I need to show to the user the
              > > > > progress
              > > > > > of
              > > > > > > the operation and here is the problem. I try to access to the[/color]
              > > Session[color=darkred]
              > > > > > > Variables from inside the thread to show it on a page that
              > > > automatically
              > > > > > > refresh, BUT, I have discovered that there is no access to the
              > > > > httpcontext
              > > > > > > from inside the new thread. Is there any other way to do this??
              > > > > > >
              > > > > > > Thanks a lot.
              > > > > > >
              > > > > > > --
              > > > > > > Roberto López
              > > > > > > Dpto. Soporte Software
              > > > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
              > > > > > >
              > > > > > >
              > > > > >
              > > > > >
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • John Saunders

                #8
                Re: Threading and Session Objects

                Roberto, don't do that.

                Instead, house your thread in a separate class. Give that class a private
                member variable of type HttpContext, say, m_Context. Write a public property
                of type HttpContext say, TheContext.

                To use the thread, create an instance of the thread class. Then use that
                instance to set the property:

                myThread.TheCon text = Page.Context

                Then start the thread. The thread can then access m_Context instead of
                HttpContext.Cur rent.

                --
                John Saunders
                Internet Engineer
                john.saunders@s urfcontrol.com

                "Roberto López" <rlopez@eurosis temas.net> wrote in message
                news:O3LPLErWDH A.2268@TK2MSFTN GP11.phx.gbl...[color=blue]
                > The problem is that I not only need to read values from session variables,
                > i need to update session variables while the new thread is running, and[/color]
                here[color=blue]
                > is the problem. When i try to set a new value to a session variable I
                > receive
                > the error of HttpContext is a Null Reference.
                > I need to store a value into the session variable to read it periodically
                > from other
                > page to know about the status of the process. I hope you understand me.
                >
                > My code is like this:
                >
                > public class AccessIO
                >
                > public sub New()
                >
                > end sub
                >
                > public sub CopyFiles()
                > ...routine to copy files...
                > ...... ..... ... ..
                >
                >
                > ...here is the error...
                > httpcontext.cur rent.session("P ercentComplete" ) = anyvalue
                >
                > end sub
                >
                > end class
                >
                >
                > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
                > news:Ogl801qWDH A.1644@TK2MSFTN GP10.phx.gbl...[color=green]
                > > Perhaps you could supply a reproducer? I don't immediately see why there
                > > would be a problem passing Page.Context to the new thread before it[/color]
                > starts.[color=green]
                > > In particular, I can't imagine how, if you passed a non-null HttpContext
                > > into the thread, it would become null. I can understand how it could[/color]
                > become[color=green]
                > > invalid, but not how it could become null.
                > > --
                > > John Saunders
                > > Internet Engineer
                > > john.saunders@s urfcontrol.com
                > >
                > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                > > news:eHD7uoqWDH A.2100@TK2MSFTN GP11.phx.gbl...[color=darkred]
                > > > I have tryed it too. :-(
                > > >
                > > >
                > > > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
                > > > news:uneo$gqWDH A.2064@TK2MSFTN GP11.phx.gbl...
                > > > > Try HttpContext.Cur rent.Session.
                > > > > --
                > > > > John Saunders
                > > > > Internet Engineer
                > > > > john.saunders@s urfcontrol.com
                > > > >
                > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                > > > > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..
                > > > > > I just readed this article but, what i need is to access to the[/color]
                > > session[color=darkred]
                > > > > > object from within a class. And doing it I alwais receive an[/color][/color][/color]
                error.[color=blue][color=green][color=darkred]
                > > > > >
                > > > > >
                > > > > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el[/color][/color]
                > mensaje[color=green][color=darkred]
                > > > > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...
                > > > > > > Here's an article:
                > > > > > >
                > > > > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
                > > > > > >
                > > > > > > --
                > > > > > > S. Justin Gengo, MCP
                > > > > > > Web Developer
                > > > > > >
                > > > > > > Free code library at:
                > > > > > > www.aboutfortunate.com
                > > > > > >
                > > > > > > "Out of chaos comes order."
                > > > > > > Nietzche
                > > > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                > > > > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
                > > > > > > > Hi,
                > > > > > > > I´m doing an asp.net application that uploads and downloads[/color][/color]
                > files[color=green][color=darkred]
                > > > and
                > > > > > > > folders between the client and the server on my intranet. To[/color][/color][/color]
                do[color=blue][color=green]
                > > this[color=darkred]
                > > > I
                > > > > > > have
                > > > > > > > create threads and it runs Ok but I need to show to the user[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > > > progress
                > > > > > > of
                > > > > > > > the operation and here is the problem. I try to access to the
                > > > Session
                > > > > > > > Variables from inside the thread to show it on a page that
                > > > > automatically
                > > > > > > > refresh, BUT, I have discovered that there is no access to the
                > > > > > httpcontext
                > > > > > > > from inside the new thread. Is there any other way to do[/color][/color][/color]
                this??[color=blue][color=green][color=darkred]
                > > > > > > >
                > > > > > > > Thanks a lot.
                > > > > > > >
                > > > > > > > --
                > > > > > > > Roberto López
                > > > > > > > Dpto. Soporte Software
                > > > > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
                > > > > > > >
                > > > > > > >
                > > > > > >
                > > > > > >
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Homa

                  #9
                  Re: Threading and Session Objects

                  Although I don't know what will the performance impact be, but I think
                  this should work:

                  In your main thread, the thread have valid permission to access/modify
                  Session, you can process the events raised by the threads and do
                  Invokes inside the handlers, then you can do what ever you want.

                  Therefore, create some events for the theads (I assume you use a class
                  to wrap the thread function).

                  Hope it helps,
                  Homa Wong

                  "Roberto López" <rlopez@eurosis temas.net> wrote in message news:<O3LPLErWD HA.2268@TK2MSFT NGP11.phx.gbl>. ..[color=blue]
                  > The problem is that I not only need to read values from session variables,
                  > i need to update session variables while the new thread is running, and here
                  > is the problem. When i try to set a new value to a session variable I
                  > receive
                  > the error of HttpContext is a Null Reference.
                  > I need to store a value into the session variable to read it periodically
                  > from other
                  > page to know about the status of the process. I hope you understand me.
                  >
                  > My code is like this:
                  >
                  > public class AccessIO
                  >
                  > public sub New()
                  >
                  > end sub
                  >
                  > public sub CopyFiles()
                  > ...routine to copy files...
                  > ...... ..... ... ..
                  >
                  >
                  > ...here is the error...
                  > httpcontext.cur rent.session("P ercentComplete" ) = anyvalue
                  >
                  > end sub
                  >
                  > end class
                  >
                  >
                  > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
                  > news:Ogl801qWDH A.1644@TK2MSFTN GP10.phx.gbl...[color=green]
                  > > Perhaps you could supply a reproducer? I don't immediately see why there
                  > > would be a problem passing Page.Context to the new thread before it[/color]
                  > starts.[color=green]
                  > > In particular, I can't imagine how, if you passed a non-null HttpContext
                  > > into the thread, it would become null. I can understand how it could[/color]
                  > become[color=green]
                  > > invalid, but not how it could become null.
                  > > --
                  > > John Saunders
                  > > Internet Engineer
                  > > john.saunders@s urfcontrol.com
                  > >
                  > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                  > > news:eHD7uoqWDH A.2100@TK2MSFTN GP11.phx.gbl...[color=darkred]
                  > > > I have tryed it too. :-(
                  > > >
                  > > >
                  > > > "John Saunders" <john.saunders@ surfcontrol.com > escribió en el mensaje
                  > > > news:uneo$gqWDH A.2064@TK2MSFTN GP11.phx.gbl...
                  > > > > Try HttpContext.Cur rent.Session.
                  > > > > --
                  > > > > John Saunders
                  > > > > Internet Engineer
                  > > > > john.saunders@s urfcontrol.com
                  > > > >
                  > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                  > > > > news:OwpoO%23pW DHA.1640@TK2MSF TNGP10.phx.gbl. ..
                  > > > > > I just readed this article but, what i need is to access to the[/color][/color]
                  > session[color=green][color=darkred]
                  > > > > > object from within a class. And doing it I alwais receive an error.
                  > > > > >
                  > > > > >
                  > > > > > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> escribió en el[/color][/color]
                  > mensaje[color=green][color=darkred]
                  > > > > > news:#m8a6gpWDH A.2040@TK2MSFTN GP11.phx.gbl...
                  > > > > > > Here's an article:
                  > > > > > >
                  > > > > > > http://www.ftponline.com/vsm/2002_11...tures/chester/
                  > > > > > >
                  > > > > > > --
                  > > > > > > S. Justin Gengo, MCP
                  > > > > > > Web Developer
                  > > > > > >
                  > > > > > > Free code library at:
                  > > > > > > www.aboutfortunate.com
                  > > > > > >
                  > > > > > > "Out of chaos comes order."
                  > > > > > > Nietzche
                  > > > > > > "Roberto López" <rlopez@eurosis temas.net> wrote in message
                  > > > > > > news:%23Ww7zVpW DHA.2032@TK2MSF TNGP11.phx.gbl. ..
                  > > > > > > > Hi,
                  > > > > > > > I´m doing an asp.net application that uploads and downloads[/color][/color]
                  > files
                  > and[color=green][color=darkred]
                  > > > > > > > folders between the client and the server on my intranet. To do[/color][/color]
                  > this
                  > I
                  > have[color=green][color=darkred]
                  > > > > > > > create threads and it runs Ok but I need to show to the user the[/color][/color]
                  > progress
                  > of[color=green][color=darkred]
                  > > > > > > > the operation and here is the problem. I try to access to the[/color][/color]
                  > Session[color=green][color=darkred]
                  > > > > > > > Variables from inside the thread to show it on a page that[/color][/color]
                  > automatically[color=green][color=darkred]
                  > > > > > > > refresh, BUT, I have discovered that there is no access to the[/color][/color]
                  > httpcontext[color=green][color=darkred]
                  > > > > > > > from inside the new thread. Is there any other way to do this??
                  > > > > > > >
                  > > > > > > > Thanks a lot.
                  > > > > > > >
                  > > > > > > > --
                  > > > > > > > Roberto López
                  > > > > > > > Dpto. Soporte Software
                  > > > > > > > Eurosistemas Informáticos y Comunicaciones, S.L.
                  > > > > > > >
                  > > > > > > >
                  > > > > > >
                  > > > > > >
                  > > > > >
                  > > > > >
                  > > > >
                  > > > >
                  > > >
                  > > >[/color]
                  > >
                  > >[/color][/color]

                  Comment

                  • Natty Gur

                    #10
                    Re: Threading and Session Objects

                    Hi,

                    Pass the session as a parameter to the thread (works like charm). This
                    link contain example :



                    Natty Gur, CTO
                    Dao2Com Ltd.
                    34th Elkalay st. Raanana
                    Israel , 43000
                    Phone Numbers:
                    Office: +972-(0)9-7740261
                    Fax: +972-(0)9-7740261
                    Mobile: +972-(0)58-888377


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

                    Comment

                    • Roberto López

                      #11
                      Re: Threading and Session Objects

                      I don´t understand clearly the code you write, but, with this, can I write
                      new values in session variables and these are readable from other page while
                      the thread is running?


                      "Natty Gur" <natty@dao2com. com> escribió en el mensaje
                      news:OZbn9RxWDH A.3924@tk2msftn gp13.phx.gbl...[color=blue]
                      > Hi,
                      >
                      > Pass the session as a parameter to the thread (works like charm). This
                      > link contain example :
                      >
                      > http://www.developersdex.com/gurus/code/662.asp
                      >
                      > Natty Gur, CTO
                      > Dao2Com Ltd.
                      > 34th Elkalay st. Raanana
                      > Israel , 43000
                      > Phone Numbers:
                      > Office: +972-(0)9-7740261
                      > Fax: +972-(0)9-7740261
                      > Mobile: +972-(0)58-888377
                      >
                      >
                      > *** Sent via Developersdex http://www.developersdex.com ***
                      > Don't just participate in USENET...get rewarded for it![/color]


                      Comment

                      Working...