views:

1665

answers:

4

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  A: 

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.

Muad'Dib
thats not the case, I NEED to find out the path, the open file dialog gives you only the name.
silmx
I had the same problem. I used an XBAP running in fulltrust instead.
Muad'Dib
unfortunately I don't have that option :-)
silmx
A: 

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 mehtod).

Braulio
its not "forbidden stuff", its marketing, the clients decided to have SILVERLIGHT as client technology ... but we need also access to the filesystem to solve some requirements.
silmx
I mean it's forbidden right now on SL because they have cut that functionallity (to avoid the mess they make when they deploy the ActiveX technology at the beginning :-)).When I needed to play with the filesystem (in my case storing) I needed to play ping pong with the server and using a custom http handler return the file as an attachment.Cheers
Braulio
A: 

I need the same requirement.... getting the physical path for a selected file. Did you find a solution to this problem?

I will go with a signed applet that will be allowed to access the disk.
silmx
A: 

Hi, 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