Solved

asp.net threading

Posted on 2012-03-12
2
175 Views
Last Modified: 2012-03-20
I have a long running process.  My plan is to create a page which will execute the process which creates a file.  The page will kick off a thread the return to the user and not wait for it to finish.  The page will have some javascript that will keep pinging the server with a web method.  When the file is created, the webservice will return the url of the file.

1. How can I kick off the thread so that the file is created without waiting for a  callback?  Is there an easy way to kick it off then leave?

2. Is this a good method?  Should I do something else.
0
Comment
Question by:jackjohnson44
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37712032
How can I kick off the thread so that the file is created without waiting for a  callback?  Is there an easy way to kick it off then leave?
If you create a Thread object within your page, then call its Start method, execution will continue without blocking, unless you call Join at some point.

2. Is this a good method?  Should I do something else.
I guess that depends on whether or not you have structured this such that a subsequent request to the page won't try to write the file whilst another thread is doing so. Have you guaranteed that two threads won't compete with each other?
0
 

Author Comment

by:jackjohnson44
ID: 37714869
Thanks for the response.  I am actually going to pass up a guid and create a file based on that so it should be unique.

a little more info:
I am creating an excel document which could be quite large.  My plan was to load the page which will kick off the process then immediately return to the user and display a "loading" message.  The plan was to keep ping-ing my server using jQuery and search for the file using the name (guid) that I have.  When it finds it, display a link for downloading.  Make sense?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question