473,698 Members | 2,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

http download

How can I retrieve an image (.jpg) from a web site using http with VB
dotnet?

thanks
Bill

Nov 20 '05 #1
11 1560
Cor
Hi Belgie,

Have a look to webclient.downl oadfile

Very simple with that

I hope this helps?

Cor
How can I retrieve an image (.jpg) from a web site using http with VB
dotnet?

Nov 20 '05 #2
"belgie" <be****@hns.com > schrieb
How can I retrieve an image (.jpg) from a web site using http with
VB dotnet?

http://msdn.microsoft.com/library/en...nginternet.asp

sub topics
- requesting data
- Using applicaton protocols -> HTTP
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
* "belgie" <be****@hns.com > scripsit:
How can I retrieve an image (.jpg) from a web site using http with VB
dotnet?


Documentation + sample:

<http://msdn.microsoft. com/library/en-us/cpref/html/frlrfsystemnetw ebclientclassdo wnloadfiletopic .asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Hi,

Dim img As Bitmap

Dim wc As New System.Net.WebC lient

img = New
Bitmap(wc.OpenR ead("http://images.ibsys.co m/orlc/images/weather/auto/doppler_640x480 .gif"))

PictureBox1.Ima ge = img

Ken

-----------------------

"belgie" <be****@hns.com > wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
How can I retrieve an image (.jpg) from a web site using http with VB
dotnet?

thanks
Bill

Nov 20 '05 #5
Cor
Hi Ken,

Why would you do that?

Dim img As Bitmap
Dim wc As New System.Net.WebC lient
img = New

Bitmap(wc.OpenR ead("http://images.ibsys.co m/orlc/images/weather/auto/doppler
_640x480.gif"))

You convert the gif while you can do

webclient.downl oadfile("http://images.ibsys.co m/orlc/images/weather/auto/dop
pler_640x480.gi f")

Cor
Nov 20 '05 #6
Hi,

Just showing another way to do it.

Ken
-----------
"Cor" <no*@non.com> wrote in message
news:uR******** ******@TK2MSFTN GP11.phx.gbl...
Hi Ken,

Why would you do that?

Dim img As Bitmap
Dim wc As New System.Net.WebC lient
img = New

Bitmap(wc.OpenR ead("http://images.ibsys.co m/orlc/images/weather/auto/doppler
_640x480.gif"))

You convert the gif while you can do

webclient.downl oadfile("http://images.ibsys.co m/orlc/images/weather/auto/dop
pler_640x480.gi f")

Cor

Nov 20 '05 #7
Cor
Hi Ken,

Mostly I like that, but for this I think it is not that good.
As far as I know will the gif loose parts of the pixels doing this.
(If I am wrong in the last sentence, it is only what I did read)

:-)

Cor
Nov 20 '05 #8
When I try downloadfile, I always get

"An unhandled exception of type 'System.Net.Web Exception' occurred in
system.dll
Additional information: The remote server returned an error: (404) Not
Found."

I used the example from the documentation verbatim. Is this a LAN/firewall
issue possibly? I have tried to download image files which I can see in a
browser.
Function WebClientTest()
Dim remoteUri As String =
"http://www.contoso.com/library/homepage/images/"
Dim fileName As String = "ms-banner.gif"
Dim myStringWebReso urce As String = Nothing
' Create a new WebClient instance.
Dim myWebClient As New WebClient()
' Concatenate the domain with the Web resource filename. Because
DownloadFile
'requires a fully qualified resource name, concatenate the domain
with the Web resource file name.
myStringWebReso urce = remoteUri + fileName
Console.WriteLi ne("Downloadin g File ""{0}"" from ""{1}"" ......." +
ControlChars.Cr + ControlChars.Cr , fileName, myStringWebReso urce)
' The DownloadFile() method downloads the Web resource and saves it
into the current file-system folder.
myWebClient.Dow nloadFile(myStr ingWebResource, fileName)
Console.WriteLi ne("Successfull y Downloaded file ""{0}"" from
""{1}""", fileName, myStringWebReso urce)
Console.WriteLi ne((ControlChar s.Cr + "Downloaded file saved in the
following file system folder:" + ControlChars.Cr + ControlChars.Ta b +
Application.Sta rtupPath))
End Function
"Cor" <no*@non.com> wrote in message
news:uR******** ******@TK2MSFTN GP11.phx.gbl...
Hi Ken,

Why would you do that?

Dim img As Bitmap
Dim wc As New System.Net.WebC lient
img = New

Bitmap(wc.OpenR ead("http://images.ibsys.co m/orlc/images/weather/auto/doppler _640x480.gif"))

You convert the gif while you can do

webclient.downl oadfile("http://images.ibsys.co m/orlc/images/weather/auto/dop pler_640x480.gi f")

Cor

Nov 20 '05 #9
Cor
Hi Belgie,

I know minimum two situations that I cannot get all files.
Situation one, the image is on a protected part of the disk (the page
can read them but you not)
Situation two, the image is first streamwritted from a database to a
tempory internet page.

Till now I could not get a method to get them,

To get the first one is very difficult and I think illegal because it is in
my opinion a kind of hacking.

For the second situaton I think that it maybe is possible as you open in the
same time the corresponding webpage, but I never tried.

Cor
Nov 20 '05 #10

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

Similar topics

2
3148
by: Michael Foord | last post by:
I'm creating a CGI that offers files for download. After googling I though I had the right headers to send to force a download - but it sends the data to the browser instead of opening the download 'save file' dialog. Can anyone see what I'm doing wrong/suggest an alternative ? responseline = '''Content-Type: application/octet-stream Content-Disposition: attachment; filename=%s Content-Length: %s '''
1
3005
by: Silvia | last post by:
I have this code in web.config file <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="dllredirect"/> <codeBase href="http://localhost/dllrecirect/dllredirect.dll" /> </dependentAssembly> </assemblyBinding>
2
1845
by: Derrick | last post by:
Anyone been able to get a multi file HTTP download working with ASP? I have a single file download working fine with the usual setting the content type, file name, stream the file from ADO.Stream, etc. Thanks in advance!! Derrick
0
3038
by: Chuck Anderson | last post by:
I am writing a Php script to run on my home PC (Windows) that downloads an Apache access log file and inserts new entries into a database.. The only way I can access these log files is through a cPanel URL that delivers a gzipped copy of the log file with all entires for the current month (up to the current date and time). I want to run this script once a day (at night) and would like to download the gzipped file by resuming from where...
0
1502
by: Owen Jenkins | last post by:
I've been using Dev's fantastic InetTransferLib to upload and download files via ftp. Now I'm using the http procedures to have my application download zip files from my website. Although the download process works OK, it adds a few bytes to the file during the download, so a 46k file becomes 52k. I can still open the file using Winzip, but cannot open it using my active X extraction system (ActiveXZip from www.hdse.com). I get an error...
1
2251
by: Owen Jenkins | last post by:
Reposting this message from last week since I have not had a reply so far. Hopefully someone will have an idea? --- I've been using Dev's fantastic InetTransferLib to upload and download files via ftp. Now I'm using the http procedures to have my application download zip files from my website. Although the download process works OK, it adds a few bytes to the file during the download, so a 46k file becomes 52k. I can still open the file...
2
2513
by: Dmitry Duginov | last post by:
I wrote HTTP module and configured it to fire with every request to my application. In IIS6 aspnet_isapi.dll mapped as Application Extension, web.config contains the following: <system.web> <httpModules> <add name="RefFilter" type="RefFilter.RefFilter, RefFilter" />
4
1736
by: VBTricks.de.vu Webmaster | last post by:
Hello, at the moment I'm not able to finish my program. That means, I have a problem I can't solve myself. Therefore I'm asking those who already worked with HttpWebRequest... and threads. I'm writing some kind of download-manager, which is able to download several files parallely. Therefore I've created a class implementing the download function and use four threads which use four instances of the class. This works fine, except the...
15
4606
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
4
4596
by: rzimerman | last post by:
I'm hoping to write a program that will read any number of urls from stdin (1 per line), download them, and process them. So far my script (below) works well for small numbers of urls. However, it does not scale to more than 200 urls or so, because it issues HTTP requests for all of the urls simultaneously, and terminates after 25 seconds. Ideally, I'd like this script to download at most 50 pages in parallel, and to time out if and only...
0
8674
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
8603
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
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7725
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2329
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.