Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When a new async thread has been spawned using this signature, will the ASP.NET session object be available to the this new thread?

IAsyncResult asyncCall = f.BeginInvoke(null, f);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
197 views
Welcome To Ask or Share your Answers For Others

1 Answer

I don't know about which session object you are talking about but if you talk about the ASP.NET Session it might not be available. Also it is bad practice to access the ASP.NET Session from background threads. I would recommend you passing an object containing all the necessary information to this background tread instead of having it pull stuff from a session => makes it less reusable.

Normally if the caller of this thread waits for it to complete the session should be available all along but honestly it's bad design and I would simply avoid it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...