473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP.net multithreading?

Am I able to use ASP.net to multithread retrieve webpages?

Are there examples of using multithread in ASP.net?
Nov 21 '05 #1
4 2311
This is a pretty vague question so it's a bit difficult to answer directly.
There is nothing to stop you from having an ASP.NET web page spawn separate
worker threads or to do asynchronous method processing using the underlying
..NET Threadpool.

However, without knowing exactly what it is you hope to accomplish, it would
be difficult to give more than the above "general" answer.

Provide some details, and get more detail in response.
Peter
"jty202" <jt****@gmail.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Am I able to use ASP.net to multithread retrieve webpages?

Are there examples of using multithread in ASP.net?

Nov 21 '05 #2
OK specifically, I have a list of webpages I want to retrieve and parse for
information.

I want to allow the user to select which sites to retrieve and parse. When
the user enters the selection, I want to spawn a thread to retreeve and
parse for each webpage. After each thread have finish parsing the data, it
puts the extracted data in one common data holder and the thread finishes.
When all the threads finished, I want to use the data holder to display the
data in results page. So thats the multithreading I want to do.
"jty202" <jt****@gmail.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Am I able to use ASP.net to multithread retrieve webpages?

Are there examples of using multithread in ASP.net?

Nov 21 '05 #3
jty202 wrote:
OK specifically, I have a list of webpages I want to retrieve and
parse for information.

I want to allow the user to select which sites to retrieve and parse.
When the user enters the selection, I want to spawn a thread to
retreeve and parse for each webpage. After each thread have finish
parsing the data, it puts the extracted data in one common data
holder and the thread finishes. When all the threads finished, I want
to use the data holder to display the data in results page. So thats
the multithreading I want to do.


Create a new System.Net.HttpWebRequest for each page you want to fetch.
Assuming you're just doing GET (not POST) requests, all you need to do is
call BeginGetResponse on each request and it will be processed by a worker
thread from the ASP.NET I/O pool.

The worker threads will call your AsyncCallback as each request completes
and you can get the stream and read the response into whatever structure
suits your needs.

Your main thread (the one that initiated all the GETs) will need to block on
a suitable synchronization structure that becomes signalled when all the
async requests have completed (or optionally, wakes up each time a request
complete and blocks again if more requests are still in flight).

-cd
Nov 21 '05 #4
Jty

You got a nice and in my opinion very good answer from Carl, I want to warn
you for what you are doing. Carl wrote already that your mainthread is
dependend from all your worker threads. However in a websolution you have
normally not one client who is active, it will give you a lot of
synchronization in my opinion.

I would first try it without the multithreading.

Only trying to prevent you from the hole a lot went in.

Cor
Nov 21 '05 #5

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

Similar topics

1
by: dixp | last post by:
I'm new to writing multithreaded apps and I have a design question. I have a winforms app and a class which has a method that does processing which is time intensive. I want the user to be able...
47
by: mihai | last post by:
What does the standard say about those two? Is any assurance that the use of STL is thread safe? Have a nice day, Mihai.
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
5
by: sarge | last post by:
I would like to know how to perform simple multithreading. I had created a simple form to test out if I was multithreading properly, but got buggy results. Sometime the whole thig would lock up...
9
by: tommy | last post by:
hi, i have found a example for multithreading and asp.net http://www.fawcette.com/vsm/2002_11/magazine/features/chester/ i want to speed up my website ... if my website is starting, they...
2
by: Rich | last post by:
Hello, I have set up a multithreading routine in a Test VB.net proj, and it appears to be working OK in debug mode and I am not using synchronization. Multithreading is a new thing for me, and...
55
by: Sam | last post by:
Hi, I have a serious issue using multithreading. A sample application showing my issue can be downloaded here: http://graphicsxp.free.fr/WindowsApplication11.zip The problem is that I need to...
5
by: sandy82 | last post by:
Whats actuallly multithreading is ... and how threading and multithreading differ . Can any1 guide how multithreading is used on the Web .. i mean a practical scenario in which u use...
2
by: Pradnya Patil | last post by:
hi , I am trying to draw ' html div-tag ' on the screen which will resemble a rectangle through vb.net code. I want it to be drawn faster...so I introduced multithreading using Threadpool. I...
7
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.