473,324 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Downloading a file from a website

Hi all,

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Kind regards,

Chris
Jul 21 '05 #1
5 1103
What do you want to do? You don't need .NET for that. <A
HREF="file.ext">Click to download</A>
"Chris Morrison"
<chris-[NO-SPAM]morrison@rassalom-[SPAM_BLOCK]technology.co.uk> wrote in
message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Kind regards,

Chris

Jul 21 '05 #2
What do you want to do? You don't need .NET for that. <A
HREF="file.ext">Click to download</A>
"Chris Morrison"
<chris-[NO-SPAM]morrison@rassalom-[SPAM_BLOCK]technology.co.uk> wrote in
message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Kind regards,

Chris

Jul 21 '05 #3
Cor
Hi Chris,

system.net.Webclient

Cor

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Jul 21 '05 #4
Cor
Hi Chris,

system.net.Webclient

Cor

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Jul 21 '05 #5
use the following code:

url - the url of the file to be downloaded.
// Create a request to the URL.

WebRequest request = WebRequest.Create(url);

// Get response from the request made, as a stream

WebResponse response = request.GetResponse();

Stream stream = response.GetResponseStream();

StreamReader reader = new StreamReader(stream);

// read the content of the stream as a string.

string content = reader.ReadToEnd();

// save the same in a temp file.

"Chris Morrison"
<chris-[NO-SPAM]morrison@rassalom-[SPAM_BLOCK]technology.co.uk> wrote in
message news:eo**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Can anyone tell me which .NET class I need (or provide a code sample) to
download file from a website/url (Not FTP) and save it to my hard drive.

Kind regards,

Chris

Jul 21 '05 #6

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

Similar topics

2
by: Ernst | last post by:
Hello, I'm using Linux Redhat 8.0 (LAMP). I have a file tx.zip , that is placed in /tmp. Now I want people to be able to download this file without copying it to the website tree Can I make a...
1
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a...
3
by: ASP Spam Fighter | last post by:
Curt_C Wrote: > open the request in a new window That would work fine for me, but I'm writing this script for people who believe that we must assume total and utter user stupidity. Since this...
5
by: John Morgan | last post by:
I am using the following link to download a file of about 50k <a target= "_blank" href="http://www.bsecs.org.uk/ExecDocs/documentStore/elfridaWord.doc">open file</a> If I save the file to...
2
by: Dave | last post by:
Dear Sirs, Is there a way to get the width and height of an image without downloading the image, or with just downloading a minimal portion of the image? For instance, I have a list of 10,000...
0
by: Sathya | last post by:
Hi Am using an ASP.NET website. i have an excel template stored in a folder in the server. the excel template already has some data inside. i need to add some more data to the excel sheet...
3
by: Paul Wilson | last post by:
Hi guys, I'm trying to enable downloading of a file from a website (my own website) from a windows application done in vb.net. Does anyone have a sample code for this (NOTE : I don't want to use...
4
by: M. Noroozi Eghbali | last post by:
Hi, I need to download a file using OnClick event or Command of a ASP button. Is there any possible code for this? In ASPX file: <ASP:Button id="button1" runat="server" text="Start...
5
by: rony_16 | last post by:
Hi, I have a problem downloading a file . after i connect to the website and get the stream , i treing to write the file on the HD. public void SaveStreamToFile(string filePath, Stream stream) {...
0
by: jannyguy | last post by:
Hi, I have a web application running on an apache server. It has a download link for downloading a file. My requirement is to download this file without asking the user where to download....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.