🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #906

Re: TCppWebBrowser - how to catch errors?

#906
From: Remy Lebeau (TeamB)
Date: Thu, 01 Dec 2005 20:17
38 lines
2690 bytes
"Robert Turlej" <turli@poczta.fm> wrote in message
news:ops03x1nilu90ivn@turli...
Hello!

> when user first time use application must set on URL to the website
> with database, but when he will write wrong URL he will se page
> with infrmations 'this site couldn't be find'. I would like to catch this
> error and show other informations. How to do it?

That depends on what the server is actually sending back as a response.
Some servers send back actual errors when a file cannot be found.  Other
servers send back a successful response and the returned HTML then contains
the error message.  I would suggest performing all of the HTTP activity
using a separate non-visual HTTP component/library to download content, and
then display the content in the TCppWebBrowser only if it is ok to be
displayed.  That will give you much more control over the HTTP
communications as well as to validate the returned content before the user
sees it.

> how to make blockade for some websites..for example user can't
> put url to www.google.com he can only use only one website.

Don't let the user type in any URL in the first place.  Put the URL into
your code directly instead.

> For example this website can have on the top this code
> <!-- code 1999 --> so other websites without this code can't be
> display in application.

The only way to handle that is to first download the page normally and then
parse its HTML afterwards.  Although TCppWebBrowser can be used for getting
that HTML, the user will still see the page.  Again, I would suggest using a
separate non-visual HTTP component/library to download the HTML and then
display it in the TCppWebBrowser only if it is allowed to be displayed.


Gambit
Technical Details
Message-ID: <438f5a95$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <ops03x1nilu90ivn@turli>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,f570d79e87ba7680
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <ops03x1nilu90ivn@turli>
Subject: Re: TCppWebBrowser - how to catch errors?
Date: Thu, 1 Dec 2005 12:17:35 -0800
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <438f5a95$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1133468309 68.69.17.41 (1 Dec 2005 12:18:29 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail