none
Trying to open an excel file with FileStream, file is being opened from the server path, not the user path RRS feed

  • Question

  • I have a c# application working with file upload that uses FileStream to open excel file.

    I have set a default directory for the excel file in my code since file upload does not include FilePath.

    When I merge it to the server, it returns an error, trying to find the file in the server directory but not in the user directory.

    I would like to hear an answer for this, 

    Many Thanks.

    Friday, November 16, 2018 1:33 AM

All replies

  • If it's web application you need to upload the file using FileUpload control (or input type="file" tag) to upload it to server.

    If it's service application, you need your client application move the file to a location that is accessible from service process.

    If your "default directory" is mapped drive, you'll have to login as the service user on the server and enter the credential there, and then change the setting to use UNC path instead.

    Friday, November 16, 2018 2:04 AM
    Answerer
  • If this is a web application then please post in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Friday, November 16, 2018 3:24 AM
    Moderator
  • Hi Ron Valero,

    According to your description, I am not sure what cause the issue, could you please share a bit more information about the issue, such as related code snippets, detailed error message, the steps that we could reproduce the issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 19, 2018 5:36 AM
    Moderator