Click here to Skip to main content
Click here to Skip to main content

How to transfer files from one webserver to another webserver

, 8 Mar 2005
Rate this:
Please Sign up or sign in to vote.
An article which describes how to transfer files from one webserver to another webserver.

Screen Shot of Download file screen


This article describes about a common requirement of transferring files from one web server to another web server.


When I was working in some project, there was a requirement where I had a web application (http://someserver/someapplication) from where I had to transfer the files to another web server (http://www.someotherserver/someotherapplication). So, I thought why should not I share the same with you all.

Using the code

Download the WebRequest project and WebRequestReceiver project. Install it in a convenient location, e.g.: c:\inetpub\wwwroot. The ZIP file contains both projects.

This article has two projects:

  1. A main project which contains the code to upload/download files.
    1. To transfer/upload a file from one webserver to another webserver (frmUploadFile.aspx).
    2. To retrieve/download a file from the other webserver to the location machine (frmDownloadFile.aspx).
  2. A Web Request Receiver project which will save the files that are posted to it.

The application makes use of the WebClient class provided in the .NET framework.

// For uploading the file
    WebClient oclient = new WebClient(); 
    byte[] responseArray = 
    lblStatus.Text = 
       "Check the file at " + Encoding.ASCII.GetString(responseArray); 
catch (Exception ex) 
    lblStatus.Text = ex.Message;

// For downloading the file
    WebClient oclient = new WebClient();
    lblStatus.Text = "Check the file at " + txtFileLocation.Text;
catch (Exception ex)
    lblStatus.Text = ex.Message;

When I say uploading the file from one web server to another web server, it basically posts the file from one web server to another web server like the way a file from the client side is posted when you use <input type="file">.

Points of Interest

This example is useful in places where you have to post files from one web server to another web server.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Devakumar Sai Chinthala
Founder &
United States United States
No Biography provided

Comments and Discussions

QuestionThe underlying connection was closed: An unexpected error occurred on a receive. PinmemberRajaSrirangan4-Oct-11 3:48 
GeneralMy vote of 1 Pinmemberharsh073416-Jun-10 2:11 
QuestionHow to transfer Databse from offline server into online Server Pinmemberrprabu4-Sep-07 5:22 
AnswerRe: How to transfer Databse from offline server into online Server [modified] PinmemberVerma Ankit2-Apr-10 3:20 
Questioni got error in this Pinmembermisterrind9-Apr-07 20:27 
Generalfile transfering between client server Pinmemberwafa2341912-Mar-07 1:01 
GeneralPlease Help PinmemberLinda dsouza10-Jul-06 0:33 
QuestionGot 500 internal error ocured PinmemberVipul17-Apr-06 4:54 
QuestionHow can i use it in asp Pinmemberbutterfly1012-Jan-06 20:41 
My web application is asp code. I want to transfer file from file server(no iis) to web server. Did i can use your code to plug-in with my code. If I can how can i do it? If i can't did you have another advise for me??
Thank you
GeneralThank You!!! Pinmemberpunitkshah24-Nov-05 1:26 
GeneralRe: Thank You!!! PinmemberDRKARTHIKRAJ22-May-12 21:10 
GeneralAre only doc files allowed Pinmemberpunitkshah23-Nov-05 22:21 
GeneralHelp!!! Pinmemberpunitkshah23-Nov-05 21:07 
Questionhow can i transfer files from one server to other server directly? Pinmembernju768-Sep-05 1:15 
GeneralDont repost Pinmemberleppie9-Mar-05 0:38 
GeneralAttempt failed to Upload PinmemberKishore P. Krishna19-Jul-05 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150327.1 | Last Updated 9 Mar 2005
Article Copyright 2005 by Devakumar Sai Chinthala
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid