Multithreading and file writing problem...

bj199347

Newcomer
Joined
Aug 26, 2006
Messages
2
Hello All,

I am pretty new to multithreading but recently came across a problem which I feel needed to use multple threads.

I am creating a dashboard app in asp.net c# which has a number of different sections (panels). Each section loads data for different departments such as finance, sales, markting etc. Each of the sections has a different database query attached to it and some obviously take longer than others. In some cases the queries can take 15-20 seconds to return results.

I need to show a progress indicator for each section which is replaced when the data has loaded for the section and then a pretty graph is displayed in place of the progress animation.

The graphs displaying the data create an xml file on the fly from the database and store this on the server. Because I need multiple threads to look after each section I need each thread to access the same method which create my xml file however the file can not be created by the threads. I believe this is because different processes cannot access the files at the same time? How do I get arounf this? Is there a way to make the thread act as the worker process or do I need to queue the threads somehow?

Any help would be appreciated. Thanks
 
When you are using web applications threading is not an easy option - as your .Net code is running on the server there is no way for it to control how a client browser handles multiple threads.

Probably the easiest option is to look at the AJAX Toolkit as this will allow you to use javascript on the client to talk to server side code with a fairly minimal amount of effort.
 
Back
Top