.NET Framework 2.0For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
a) You are creating a local variable inside the Page_Load method. This variable will not be available inside other methods, like btnAbort_Click1. Therefore your code wont even compile.
b) You are using ASP.Net - Page_Load is run everytime the page loads - this includes the first time the page is viewed, and again when the button is clicked, so you just started at least 2 new threads. Which one do you expect the abort button to try and abort?
c) HTTP is stateless - your page is created, destroyed and recreated every time you refresh the page. Even if you stored the thread as a page property it wouldn't exist (or at least not point to the same Thread) once the page was reloaded.
Hi there.. Maybe I'm confused, but unless that thread die by itself, you will end up with a lot of new threads that are not killing by anyone..
If you are in a web enviroment, you could always close your explorer and never kill the thread... Maybe you want to do something that can be do in another way???
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question: http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof: http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Threads are not horrible things, but you really need to know how to use them..
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question: http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof: http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========