473,791 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1952
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 BeginGetRespons e 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.co m

"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.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

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

Similar topics

2
1972
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 reference counting but i've hit a snag. I'm creating objects within python then linking them to their C counterparts, what i want to do now is directly access the python class variable objects from C. Basically i have the python class object as a C...
3
3614
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 non-standard C++ or if the problem lies elsewhere. To summarize static const class members are not being accessed properly when accessed from a DLL by another external object file (not within the DLL). It only occurs when the static const...
3
2239
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. Someone on the SuSE programming mailing list suggested my problem is that I'm trying to execute a function (I assume he meant the constructor) at compile time. The same source code compile if I don't try to split it up into separate libraries. ...
4
6745
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 can I completely hide (within the IDE) the members of the base class library i.e. only expose those members that I want exposed? I've tried some methods gleaned by googling for "hiding base class members" which suggested using things like "new" and...
0
413
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 bound to. I though this automation is on of the purposes of the databinding ... ? What am I doing wrong ? See this little example code: using System;
1
1196
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. Declaring them as just normal globals or member variables doesn't cause the said problem I've got them such a static HCURSOR g_hcWait ... MyClass::g_hcWait = LoadCursor(NULL, IDC_WAIT); //(yes I do use LoadImage really I just put that to be brief ...
0
1167
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
4317
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
4702
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 no-parameter constructor for my class with an empty function body. I then instantiated an object and tried printing its values, amazingly the members were already initialized. But how is this possible if I have not included any code for doing so. The...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.