By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 927 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

Download from web

P: n/a
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?


Apr 1 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Peter,

It is not impossible that the image is protected in a database.

Be aware that you are hacking when you try to get protected data from a
webserver.
At least in my country is there a penalty for that.

Cor

"Peter Eriksson" <pe****************@telia.com> schreef in bericht
news:O2**************@TK2MSFTNGP14.phx.gbl...
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?

Apr 1 '06 #2

P: n/a
No, I don't think it is hacking.
It is a public page. You can easily download
the pictures with rightclick in the browser.
It was just a testproject to learn about the WebClient class.
"Cor Ligthert [MVP]" <no************@planet.nl> skrev i meddelandet
news:%2****************@TK2MSFTNGP12.phx.gbl...
Peter,

It is not impossible that the image is protected in a database.

Be aware that you are hacking when you try to get protected data from a
webserver.
At least in my country is there a penalty for that.

Cor

"Peter Eriksson" <pe****************@telia.com> schreef in bericht
news:O2**************@TK2MSFTNGP14.phx.gbl...
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?


Apr 2 '06 #3

P: n/a
On Sat, 1 Apr 2006 13:47:07 +0200, "Peter Eriksson"
<pe****************@telia.com> wrote:
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?

On the mainpage, right-click the image, properties, and see what the
actual URL is to the image. That URL should retrive the correct image
if the image is static, or, it's an image that is updated periodically
but has an static file name of something like .. /latest.jpg. If it's
an updating image and has an ultimate filename that is based on
something like date/time, you will have to predetermine the current
URL (i.e. a parseHTML routine of some sort)

If VB2005 and you just want to write to disk, you can also use this
with it's various arguments:
My.Computer.Network.DownloadFile(someURL, someDest)
Gene
Apr 3 '06 #4

P: n/a
On Sun, 2 Apr 2006 22:20:14 +0200, "Peter Eriksson"
<pe****************@telia.com> wrote:
No, I don't think it is hacking.
It is a public page. You can easily download
the pictures with rightclick in the browser.
It was just a testproject to learn about the WebClient class.
"Cor Ligthert [MVP]" <no************@planet.nl> skrev i meddelandet
news:%2****************@TK2MSFTNGP12.phx.gbl...
Peter,

It is not impossible that the image is protected in a database.

Be aware that you are hacking when you try to get protected data from a
webserver.
At least in my country is there a penalty for that.

Cor

If simply downloading for personal use, via browser or app, there is
no problem. However, if in an application that ultimately downloads
and displays images form a website and the app is to be distributed,
it's best to check the website(s) to see if there is any copyright
restrictions or premissions required.

Gene
Apr 3 '06 #5

P: n/a
Peter Eriksson wrote:
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?


Might it be that the web site checks the referer (sic) property when serving
images in order to prevent what you're trying to do? (Although I don't know
if referer would be set by making a request through .NET.) If you try it on
a web server that you control, does it work as desired first time? You can
also look at the logs for clues.

Just because a URL ends in .jpg doesn't mean that it came directly from the
file - there could be a filter inbetween.

Andrew
Apr 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.