locked
Retrieiving user my documents folder path RRS feed

  • Question

  • User1016820894 posted

    I have a web application where I need to retrieve the user's my documents folder path. I can get it fine using this command while running the process from VS 2017:

    exportfolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

    But when I have deployed it to IIS and run the process through IE it is giving me the local folder on the sharepoint server where I have the web app. What commands do I need to retrieve the same information through IIS?

    Thanks.

     

    Wednesday, April 17, 2019 8:23 PM

All replies

  • User475983607 posted

    It is not possible to get the user's MyDocuments from a web server.  It works while developing as your system is both the server and the client and the server's MyDocuments are your MyDocuments.

    Wednesday, April 17, 2019 8:31 PM
  • User-1174608757 posted

    Hi baldwinjohn,

    We couldn't directly visit users Documents or users memory in our application.If it is possible , it means we get  any files of other computers and we could make changes in any files in their computers.That is obviously not secure for users. You could visit yout computer because the visit is your local machine.You have the rights to set the folder or program.

    Best Regards

    Wei

    Thursday, April 18, 2019 3:01 AM
  • User753101303 posted

    Hi,

    All your C# code runs on the web server which doesn't have any access to the client side. The purpose of this server side code is to render an HTML page which is shiown in the browser. The browser is itself a sandbox with very limited access to local resource for safety reason.

    In short the standard way for a web server to access a client side file is to let the user upload this (and for safety reason the input type=file upload control can be populated only by the user).

    It's common to be confused when  starting as you usually develop on a machine that is both the web server and the browser side machine which can give the impression things that won't ever work with a real web server could work.

    Friday, April 19, 2019 1:49 PM