473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.NullReferenceException

thanks for reply.

Lionel
Nov 15 '05 #1
4 4879
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(MyVoid));
myThread.Priority = ThreadPriority.Normal;
myThread.Start();

........

Thanks for your reply.

Lionel

-----Original Message-----
Lionel <li****@liilo.com> wrote:
I'm trying to call a specific void in a new thread.


What do you mean by "a specific void"?
it works but if I try to save object in the session via
this void, I've got System.NullReferenceException


Please post some code so we can see what you're doing.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
.

Nov 15 '05 #2
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(MyVoid));
myThread.Priority = ThreadPriority.Normal;
myThread.Start();

........

Thanks for your reply.

Lionel

-----Original Message-----
Lionel <li****@liilo.com> wrote:
I'm trying to call a specific void in a new thread.


What do you mean by "a specific void"?
it works but if I try to save object in the session via
this void, I've got System.NullReferenceException


Please post some code so we can see what you're doing.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
.

Nov 15 '05 #3
Lionel <li****@liilo.com> wrote:
here is a part of my code

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


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

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #4
Lionel <li****@liilo.com> wrote:
here is a part of my code

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


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

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something...
2
by: C | last post by:
All, I am trying to run my BO in a separate thread, so that I can give the user a visual of the status of my process in a asp.net page/site. All works fine, IF the ASPNET user has admin rights,...
1
by: wekrato | last post by:
Hi! I want to do a comfortable way of importing a file into my system via a webpage. When importing, the following three components run at the same time: - ImportStatus which shows how far the...
2
by: John | last post by:
Is there a safe way to gain access to the session object from inside a spawned thread, in ASP.NET? I'm familiar with the principle of creating a data storage object, passing a reference to the...
12
by: Anthony Jones | last post by:
Here's a question that I've not been able to get a definitive answer to. Creating an STA object (such as a typical VB6 object) and assigning to the ASP Session store is a bad thing. It's a bad...
1
by: JEB | last post by:
I know that with Web Services, you should be doing everything in a stateless environment. However, I have three methods out of over 100 that need state. I have the client cookie container,...
0
by: fiefie.niles | last post by:
I am having problem with thread. I have a Session class with public string variable (called Message) that I set from my Main program. In the session class it checks for the value of Message while...
5
by: fniles | last post by:
I am having problem with thread. I have a Session class with public string variable (called Message) that I set from my Main program. In the session class it checks for the value of Message...
4
by: Diffident | last post by:
Hi All, I am trying to perform a non-CPU bound operation in an asynchronous fashion using 'Thread' and a delegate. Basically, I am spawning a thread using ThreadStart and Thread. My non-CPU...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.