Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Pulling Files From a Web Site based on the URL path.

Reply
Thread Tools

Pulling Files From a Web Site based on the URL path.

 
 
Guest
Posts: n/a
 
      02-03-2006
Hello,

I have a client that is feeding PDF files to me. They do not want me to
link to their files since that can put a strain on their bandwidth. What
they asked I do is download the file and store it on my server.

My question is, how do I download a file based on a url at runtime?

In other words, I have an xml file from my client with hundreds of PDF file
urls. I want to write a program that parses out the XML file and
automatically downloads the PDF files and places them locally on my server.

How would this be done?

I dont need to know how to parse the XML file or add the files to my server.
I just need to know the method of how to pull the file from their server
programatically.

I'm sure this is extremly easy, I just dont know where to start.

Thanks,

J


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      02-03-2006
The most simplistic way is to use the WebClient DownloadData method, wich
returns a byte array. YOu can then create a filestream with the appropriate
name and extension and write this to a PDF file.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"(E-Mail Removed)" wrote:

> Hello,
>
> I have a client that is feeding PDF files to me. They do not want me to
> link to their files since that can put a strain on their bandwidth. What
> they asked I do is download the file and store it on my server.
>
> My question is, how do I download a file based on a url at runtime?
>
> In other words, I have an xml file from my client with hundreds of PDF file
> urls. I want to write a program that parses out the XML file and
> automatically downloads the PDF files and places them locally on my server.
>
> How would this be done?
>
> I dont need to know how to parse the XML file or add the files to my server.
> I just need to know the method of how to pull the file from their server
> programatically.
>
> I'm sure this is extremly easy, I just dont know where to start.
>
> Thanks,
>
> J
>
>
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RFdT?=
Guest
Posts: n/a
 
      02-03-2006
Easy
dotnet 2.0 system.net.WebRequestMethods.File

Intermediate
dotnet 1.1 system.net.webrequest.

Download the 101 samples for vs 2003 and grab the how to send and receive
data example
http://www.microsoft.com/downloads/d...ng=en#filelist

Good Luck
DWS
reply to the group or thread if you need more help on this.


"(E-Mail Removed)" wrote:

> Hello,
>
> I have a client that is feeding PDF files to me. They do not want me to
> link to their files since that can put a strain on their bandwidth. What
> they asked I do is download the file and store it on my server.
>
> My question is, how do I download a file based on a url at runtime?
>
> In other words, I have an xml file from my client with hundreds of PDF file
> urls. I want to write a program that parses out the XML file and
> automatically downloads the PDF files and places them locally on my server.
>
> How would this be done?
>
> I dont need to know how to parse the XML file or add the files to my server.
> I just need to know the method of how to pull the file from their server
> programatically.
>
> I'm sure this is extremly easy, I just dont know where to start.
>
> Thanks,
>
> J
>
>
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      02-04-2006
Thanks to both of your responses. That helped me a bunch. I don't know
which one I am going to use but I think I will try the .net 2.0 way first.

J

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I have a client that is feeding PDF files to me. They do not want me to
> link to their files since that can put a strain on their bandwidth. What
> they asked I do is download the file and store it on my server.
>
> My question is, how do I download a file based on a url at runtime?
>
> In other words, I have an xml file from my client with hundreds of PDF
> file urls. I want to write a program that parses out the XML file and
> automatically downloads the PDF files and places them locally on my
> server.
>
> How would this be done?
>
> I dont need to know how to parse the XML file or add the files to my
> server. I just need to know the method of how to pull the file from their
> server programatically.
>
> I'm sure this is extremly easy, I just dont know where to start.
>
> Thanks,
>
> J
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-06-2006
Hi J,

If the files you want to programmaticaly download are located through http
url, the .NET framework 1.1's network components are enough. One
improvement of .NET 2.0's webreuqest components is the FtpWebRequest which
can help handle Ftp protocol communications. And for normal http based
file download/upload, the webclient class(available in both 1.1 and 2.0) is
a simple and quick solution. Also, if you want to have more control on the
underlying http message, you can choose to use httpwebrequest class
directly. Here are some articles mentioned using those component to
download http base files:

#Uploading and Downloading Files
http://www.c-sharpcorner.com/Interne...esponseMDB.asp

#Download a Web Pages Contents and Save them to a File in VB.NET
http://www.freevbcode.com/ShowCode.asp?ID=2174

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List of free web site design, web site backgrounds, web site layoutsresources cyber XML 1 12-25-2007 11:48 PM
Free web site design, web site backgrounds, web site layoutsresources cyber HTML 0 12-24-2007 04:26 PM
List of free web site design, web site backgrounds, web site layoutsresources cyber HTML 0 12-21-2007 03:47 PM
List of free web site design, web site backgrounds, web site layoutsweb sites cyber HTML 1 12-19-2007 09:07 AM
Pulling data based on date time returns error xhoster@gmail.com Perl Misc 5 08-17-2006 05:50 PM



Advertisments