Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:05:42+00:00 2026-05-24T12:05:42+00:00

It´s possible to use two urls with File.Copy with C#? I´m getting different errors

  • 0

It´s possible to use two urls with File.Copy with C#? I´m getting different errors :

  1. URI formats are not supported

  2. The given path’s format is not supported.

There is a question some similar but is not answered.

I want copy from a directory that is in server1 to another server and the urls are http

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:05:43+00:00Added an answer on May 24, 2026 at 12:05 pm

    you can use File.Copy only if we are not talking about an FTP. in that case you can use the code below

    if you have an FTP you can use the below code:

    public void ftpfile(string ftpfilepath, string inputfilepath)  
    {  
        string ftphost = "127.0.0.1";  
        //here correct hostname or IP of the ftp server to be given  
    
        string ftpfullpath = "ftp://" + ftphost + ftpfilepath;  
        FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);  
        ftp.Credentials = new NetworkCredential("userid", "password");  
        //userid and password for the ftp server to given  
    
        ftp.KeepAlive = true;  
        ftp.UseBinary = true;  
        ftp.Method = WebRequestMethods.Ftp.UploadFile;  
        FileStream fs = File.OpenRead(inputfilepath);  
        byte[] buffer = new byte[fs.Length];  
        fs.Read(buffer, 0, buffer.Length);  
        fs.Close();  
        Stream ftpstream = ftp.GetRequestStream();  
        ftpstream.Write(buffer, 0, buffer.Length);  
        ftpstream.Close();  
    }
    

    then you can do

    ftpfile(@"/testfolder/testfile.xml", @"c:\testfile.xml");
    

    if we are talking about a shared folder on the same network you can do the below:

    File.Copy(filepath, "\\\\192.168.1.28\\Files");
    

    for HTTP you can use the below:

    using(WebClient client = new WebClient()) {
        client.UploadFile(address, filePath);
    }
    

    source:

    Send a file via HTTP POST with C#

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use Except() for two List's that have two different classes
is it possible to use two web browser controls with different proxies without writing
I use custom routes for my URLs and my action become accessible via two
I try to use two different jqgrid on the same page with the mvc
I have recently started looking into Google Charts API for possible use within the
Possible Duplicate: Use SVN Revision to label build in CCNET I'm working through the
Is it possible to use a flash document embedded in HTML as a link?
Is it possible to use Apache Subversion (SVN) as general purpose backup tool? (As
Is it possible to use Microsoft Entity Framework with Oracle database?
Is it possible to use an UnhandledException Handler in a Windows Service? Normally I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.