0

I have an issue with Silverlight application and SaveFileDialog. Basically I'm using SaveFileDialog in order to get from user path where he wants to save file and what is the file name. Then I'm passing that path to an API of other application(I'm using Silverlight 5 in Elevated Trust mode) which creates file for me.

Problem arise when user uses IE8 in Protected Mode.

SaveFileDialog.SafeFileName returns just a name of the file, not the path, and when I try to get that path with FileInfo, I'm getting always desktop no matter what user has selected.

  1. I tried different approaches, including write just one byte into the file using stream from the SaveFileDialog.OpenFile - no success

  2. I tried to access private member of SaveFileDialog.File.DirectoryName using reflection - property is marked with [SecurityCritical] so I cannot access...

  3. I'm planning now to try invoke native browser save dialog using js in order to accomplish this but I'm not sure it will be different than Silverlight dialog.

Anyone out there smarter or more experienced than me around this problem? :)

Thanks

Marko
  • 1,874
  • 1
  • 21
  • 36
  • 1
    I would be very surprised if there was a way of doing this. In fact, I would probably consider it a security vulnerability if there was a way. As far as I can see, the best you can hope for is to find a way of detecting protected mode and warning the user that your application won't work correctly in protected mode. As an aside, is there any way your other application can be passed an open `Stream` instead of a filename? – Luke Woodward Mar 10 '13 at 13:06
  • nice point but unfortunately no...I agree on point it is security vulnerability but only for path finding...in case where I know that virtualized paths are turned on and way how those paths are generated, it's not security problem and I think that is the only way to do it...currently don't how... – Marko Mar 11 '13 at 13:31

0 Answers0