Is "webBrowser.Navigate" a good way to continually check if a pageexists?

A

Alan

Hello,

I need to write a systemtray program to check every minute if a
certain intranet page exists. Would "webBrowser.Navigate" and catching
exceptions to it be a good choice in terms of load on the PC?

If the page exists, the program should load and display it. The
program would run on a couple of thousand PCs and the idea is to have
a very basic, one-to-many instant message.

Thanks,

- Alan.
 
G

Göran Andersson

Alan said:
Hello,

I need to write a systemtray program to check every minute if a
certain intranet page exists. Would "webBrowser.Navigate" and catching
exceptions to it be a good choice in terms of load on the PC?

If the page exists, the program should load and display it. The
program would run on a couple of thousand PCs and the idea is to have
a very basic, one-to-many instant message.

Thanks,

- Alan.

What would the reason be for the page not to exist? It would be much
easier if the page always exists, both for the server and the clients.
 
A

Alan

Thanks to all.

Göran, if the page exists, that would mean there is a message to
display. No page, no message.

Cor, I'll check out the link.

Patrice, I'll check out sockets too. But I want to keep it really
simple and sockets would mean establishing a permanent connection from
each client - plus coding a custom server component too?

I'm thinking of having each client check once a minute so the average
should be 1,000 checks a minute. I have a powerful web server which is
used very little. I was thinking for looking for the presence of a
text file in a network share instead, but I think a web server would
handle the load better.
 
G

Göran Andersson

Alan said:
Göran, if the page exists, that would mean there is a message to
display. No page, no message.

Yes, but why does the page have to be missing just because there is no
message? The page could just be an empty page when there is no message.

The server always returns a page for every request; if the requested
page doesn't exist, the server returns an error page instead. The fact
that there is no message doesn't mean that there is something wrong, so
it doesn't feel right to create an error condition for that.

Also, to handle a missing page, the client has to distinguish between
different error pages, to determine if it's just a missing message that
is causing an error page to be returned, or if it's a real error.
I'm thinking of having each client check once a minute so the average
should be 1,000 checks a minute. I have a powerful web server which is
used very little.

I suggest that you add a random factor to the delay, so that you don't
risk to get hundreds of requests at the same time every minute.
I was thinking for looking for the presence of a
text file in a network share instead, but I think a web server would
handle the load better.

Yes, you would probably get problems with a network share when the
server is trying to write to the file at the same time as several users
are trying to read it.
 
H

Herfried K. Wagner [MVP]

Alan said:
I need to write a systemtray program to check every minute if a
certain intranet page exists. Would "webBrowser.Navigate" and catching
exceptions to it be a good choice in terms of load on the PC?

If the page exists, the program should load and display it. The
program would run on a couple of thousand PCs and the idea is to have
a very basic, one-to-many instant message.

I suggest to take a look at 'WebClient' and 'HttpWebRequest'.
 
A

Alan

I see your point.

My original idea was that if there was simply no page, then there was
nothing to do. If there's always a page, then the client has to
download it, read its contents and decide whether to display it or
not.

Your idea is probably better because I also need a way to decide if
the page has been displayed before. I can do that if I'm already
parsing the contents.

And thanks for the random factor, that's a very good idea indeed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top