473,398 Members | 2,125 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,398 software developers and data experts.

Simple web fetching class with: string Get(string URL), bool Busy and Stop() members

I'm looking for simple class to get web-page with some members to
control execution:
1. string Get(string URL) - just get html-page
2. bool Busy - return true while object loading resource
3. Stop() to stop execution

There are problems to use HTTPWebRequest.GetResponse as it lock main
thread.

any ideas?

Regards,
Anton

Mar 19 '07 #1
10 1926
On Mar 19, 8:35 am, x.meg...@gmail.com wrote:
I'm looking for simple class to get web-page with some members to
control execution:
1. string Get(string URL) - just get html-page
2. bool Busy - return true while object loading resource
3. Stop() to stop execution

There are problems to use HTTPWebRequest.GetResponse as it lock main
thread.

any ideas?
Well, the most obvious is not to call GetResponse on the UI thread.
Either use a different thread, or use BeginGetResponse instead and
pass in a callback.

Jon

Mar 19 '07 #2
You can help me to realize this class? I have not experience with
threads...

Mar 19 '07 #3
I require only an opportunity to stop process and to learn its busy
state.

Mar 19 '07 #4
On Mar 19, 8:53 am, "Meglio" <x.meg...@gmail.comwrote:
You can help me to realize this class? I have not experience with
threads...
See http://pobox.com/~skeet/csharp/threads to learn about threading.

Jon

Mar 19 '07 #5
On Mar 19, 8:55 am, "Meglio" <x.meg...@gmail.comwrote:
I require only an opportunity to stop process and to learn its busy
state.
Well, there's no way of "stopping" a web request when it's been sent,
although you don't need to fetch the whole response, of course. As for
"busy" - I guess that's any time before you've received the whole
response.

Jon

Mar 19 '07 #6
I need just to stop data transferring process when Stop() is called
immediately. Is it possible with treads?

Mar 19 '07 #7
I'm also Delphi developer, so, for example, in Delphi I create hidden
TWebBrowser component,
then call Navigate(URL), and can use Busy: boolean property as well as
Stop method.

Mar 19 '07 #8
The WebRequest (which HttpWebRequest derives from) has an Abort method
which can be used to abort a request.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
On Mar 19, 8:55 am, "Meglio" <x.meg...@gmail.comwrote:
>I require only an opportunity to stop process and to learn its busy
state.

Well, there's no way of "stopping" a web request when it's been sent,
although you don't need to fetch the whole response, of course. As for
"busy" - I guess that's any time before you've received the whole
response.

Jon

Mar 19 '07 #9
but when HTTPWebRequest is called, thread is blocked,
and we can wait for GetResponse method.
So, we can't call Abort() method

Mar 21 '07 #10
On Mar 21, 11:52 am, "Meglio" <x.meg...@gmail.comwrote:
but when HTTPWebRequest is called, thread is blocked,
and we can wait for GetResponse method.
So, we can't call Abort() method
So don't use GetResponse - use BeginGetResponse, as I suggested
before.

Jon

Mar 21 '07 #11

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

Similar topics

2
by: disgracelands | last post by:
I'm starting to develop an application in Python running the interpreter from C, i've got callbacks and stuff setup (was pretty pleased with that) and i'm starting to get my head around the...
3
by: DanielBradley | last post by:
Hello all, I have recently been porting code from Linux to cygwin and came across a problem with static const class members (discussed below). I am seeking to determine whether I am programming...
3
by: Steven T. Hatton | last post by:
Sorry about the big code dump. I tried to get it down to the minimum required to demonstrate the problem. Although this is all done with GNU, I believe the problem I'm having may be more general. ...
4
by: C-Sharper or C-Hasher, one of the two | last post by:
Hi, I have a C# class libary (Class1) which is inherited by another class in a Windows Forms app. I want this other class to implement some, but not all of the features of the base class. How...
0
by: Robert Ludig | last post by:
How do I bind a textbox to a simple string varaible with databinding? I managed to do the binding but unfortnatedly the textvox does not get updated when I change the string wich the textbox is...
1
by: Bonj | last post by:
I'm having problems using static members of a class (largely HANDLEs of various sorts) as static class members of a class. It compiles OK but the linker complains of unresolved external symbol....
0
by: lovecreatesbea... | last post by:
I) List of synthesized class members By default, a class gets 1. default construction 2. copy construction 3. assignment 4. . (dot) 5. , (comma) 6. destruction
2
by: Dennis Jones | last post by:
Hello, I have a class that will eventually look something like this: class TTableHolder { private: boost::scoped_ptr<TSessionFSession; boost::shared_ptr<TTableFTable;
10
by: Joel | last post by:
Is it true that if we don't specify a default constructor for our class, then the C# compiler provides us with its own that zeroes (or assigns default values) to the data members? I wrote a...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.