Thread and session

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

    Thread and session

    hi,

    I'm trying to call a specific void in a new thread.
    it works but if I try to save object in the session via
    this void, I've got System.NullRefe renceException

    thanks for reply.

    Lionel
  • Lionel

    #2
    Re: Thread and session

    here is a part of my code

    private void MyVoid()
    {
    Session["myVar"] = "test"; // EXCEPTION HERE
    //......
    }

    and on click button event...

    Thread myThread = new Thread(new ThreadStart(MyV oid));
    myThread.Priori ty = ThreadPriority. Normal;
    myThread.Start( );

    ........

    Thanks for your reply.

    Lionel

    [color=blue]
    >-----Original Message-----
    >Lionel <lionel@liilo.c om> wrote:[color=green]
    >> I'm trying to call a specific void in a new thread.[/color]
    >
    >What do you mean by "a specific void"?
    >[color=green]
    >> it works but if I try to save object in the session via
    >> this void, I've got System.NullRefe renceException[/color]
    >
    >Please post some code so we can see what you're doing.
    >
    >--
    >Jon Skeet - <skeet@pobox.co m>
    >http://www.pobox.com/~skeet/
    >If replying to the group, please do not mail me too
    >.
    >[/color]

    Comment

    • Lionel

      #3
      Re: Thread and session

      here is a part of my code

      private void MyVoid()
      {
      Session["myVar"] = "test"; // EXCEPTION HERE
      //......
      }

      and on click button event...

      Thread myThread = new Thread(new ThreadStart(MyV oid));
      myThread.Priori ty = ThreadPriority. Normal;
      myThread.Start( );

      ........

      Thanks for your reply.

      Lionel

      [color=blue]
      >-----Original Message-----
      >Lionel <lionel@liilo.c om> wrote:[color=green]
      >> I'm trying to call a specific void in a new thread.[/color]
      >
      >What do you mean by "a specific void"?
      >[color=green]
      >> it works but if I try to save object in the session via
      >> this void, I've got System.NullRefe renceException[/color]
      >
      >Please post some code so we can see what you're doing.
      >
      >--
      >Jon Skeet - <skeet@pobox.co m>
      >http://www.pobox.com/~skeet/
      >If replying to the group, please do not mail me too
      >.
      >[/color]

      Comment

      • Jon Skeet

        #4
        Re: Thread and session

        Lionel <lionel@liilo.c om> wrote:[color=blue]
        > here is a part of my code
        >
        > private void MyVoid()
        > {
        > Session["myVar"] = "test"; // EXCEPTION HERE
        > //......
        > }[/color]

        Right, now, what is Session here? It sounds like that's what's null.

        --
        Jon Skeet - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        • Jon Skeet

          #5
          Re: Thread and session

          Lionel <lionel@liilo.c om> wrote:[color=blue]
          > here is a part of my code
          >
          > private void MyVoid()
          > {
          > Session["myVar"] = "test"; // EXCEPTION HERE
          > //......
          > }[/color]

          Right, now, what is Session here? It sounds like that's what's null.

          --
          Jon Skeet - <skeet@pobox.co m>
          Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

          If replying to the group, please do not mail me too

          Comment

          Working...