silverlight access to file path

≯℡__Kan透↙ 提交于 2020-01-04 04:34:13

问题


I have a Silverlight application and I need a way to find out the physical path for a selected file.

Note: I know about security restrictions that obtaining the path is prohibited in client.

I have in mind a solution but I am not sure it works: silverlight app is running in a page together with an ActiveX component that is allowed to do restricted operations. The Silverlight app asks the ActiveX component to do the privileged operations and returns back the path.

Is that a valid scenario or there is a simpler way?


回答1:


You can use the common file open dialog and let the user tell you where the file is. This would be the secure way to do it, w/o compromising the user's system.

You might be able to get it if you run in Full-Trust.... check out this article, it might help.




回答2:


Right now the way you are commenting it's the one that I have heard to do "forbidden stuff" (for instance send info to a printer in a bank kiosk).

And to call the ActiveX if you have restrictions on calling it from SL, you can just call it from a javascript method (Taking advantage of SL feature of calling javascript and the other way around, js calling back an SL method).




回答3:


you could not get the true path of a file in you local file system because of some security reasons. You can only get the file name, the file path is a private field, so that you cannot access it. I don't know if there is a way to get the file's whole information by analyzing its stream, as I know, you can get the file's stream by OpenFileDialog



来源:https://stackoverflow.com/questions/760701/silverlight-access-to-file-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!