No application is associated with the specified file for this operation


  • Hi,
    I have a piece of code, where I open the files stored in a server:

                            System.Net.WebClient wc = new System.Net.WebClient();
    			wc.Credentials = new System.Net.NetworkCredential(uName,pwd);

    I download the file from the server to a local drive in my pc and then open the file from the local drive.

    It's working most of the times, however for a few files, I get the following error:

    No application is associated with the specified file for this operation.

    I see the file on the server. I am able to open it as well. Not sure what's going on. Any help would be appreciated.

    Thank you


    Wednesday, April 18, 2012 2:23 PM


All replies

  • The server tries to start the file based on the extension. The error means that the application used to open the file, is not installed on the server. The reason why you can open these files, is because these applications are installed on YOUR pc, and you open those files on YOUR pc, not on the server. 

    Regards, Nico

    Wednesday, April 18, 2012 2:28 PM
  • Thanks for the response Nico. The error that I'm getting is for .jpg & .gif files. And I'm not opening the file on the server, I am downloading the file to my pc and then opening it up to avoid the exact problem you described.


    Wednesday, April 18, 2012 2:42 PM
  • Abhi,

    under which credentials is the code running?

    if the associated apps are installed on a per-user basis, it is possible that for the user under which the code is running that app is not installed.

    Regards, Nico

    Wednesday, April 18, 2012 3:02 PM
  • by app , you mean enabling them to open ".jpg" & ".gif" files?


    Wednesday, April 18, 2012 3:04 PM
  • by app I mean the applications that allow you to view the .jpg or .gif files.

    Regards, Nico

    Wednesday, April 18, 2012 3:20 PM
  • Hi iconabhi114,

      Here is a thread that is  relative to your topic, I would list it as follows:

      I suggest you that you could read the following code sample named CSWebDownloader.

     The code sample demonstrates how to create a simple web downloader and show the download progress. its implementation has mentioned WebClient,NetworkCredential and so on .It seems that you can get the more information from this code sample.


    Jason Wang

    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by iconabhi114 Wednesday, April 25, 2012 5:33 PM
    Friday, April 20, 2012 1:39 AM