tags:

views:

27

answers:

1

Hi all, I am trying to download a file from the server but i am getting this error:

The process cannot access xxxx the file because it is being used by another process

This is my CODE:

    string fileName="DownLoadFiles";
    string filePath = hid_filepath.Value;
    FileInfo file = new FileInfo(filePath);      
    System.Net.WebClient wc = new System.Net.WebClient();
    wc.DownloadFile(new Uri(fileName, filePath);

Foe ur Information:the file is not opened or not used...

Can anyone pls help me by providing whats the reason for this error and how to solve this error

A: 
 wc.DownloadFile(new Uri(fileName, filePath);

There is an error in your code, there should be a target filename specified:

 wc.DownloadFile(new Uri(fileName, filePath),"c:\file.tmp");
Willem