copying the file from one machine to another

Hi there
Please tell me how to copy a file from one machine to other connected by the LAN through asp.net using C#


Answer this question

copying the file from one machine to another

  • liujj_xujj

    You can't copy files using ASP.NET.  You can copy a file from the server to another machine on the servers network, by using File.Copy and passing a network path, I believe.


  • moondaddy

    make sure that you are using "@". Check the path. 

  • Parag Khare

    If you are using the default settings then the user that your asp.net code is running under does not have the rights to access shares on the network.  You'll need to make your asp.net run using a user that has the appropriate permissions.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

  • kamila

    I have used the copy option but I am getting the error File Not found
    Please Help
    Thanks in Advance

  • Kang

    Then go into the debugger, it's obvious that the path you're passing in is not valid.  Are you putting a @ at the start of the string, so that everything is literal


  • lhuff

    I am using this

    string path=@"\\ABC\test\WS_FTP.LOG";

    try

    {

    if(File.Exists(path))

    {

    Response.Write("exist");

    }

    else

    {

    Response.Write("Doesn't exist");

    }

    }

    catch(Exception oException)

    {

    Response.Write(oException.Message);

    }


    But still it is saying that the path doesn't exist kndly help



  • copying the file from one machine to another