Accessing Files Outside of Isolated Storage

As you've seen, Silverlight applications aren't allowed to browse the file system. But you can use several back doors to read and write individual files—provided the user selects them first. These back doors are the OpenFileDialog and SaveFileDialog classes and the drag-and-drop feature.

The OpenFileDialog and SaveFileDialog classes allow you to show a standard Open and Save dialog box in response to a user-initiated action (like a button click). The user then selects a file in the dialog box, which is returned to your code as a stream. If you show the Open dialog box, you get given a read-only stream for accessing the file. If you show the Save dialog box, you get a writeable stream. Either way, the ...

Get Pro Silverlight 5 in VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.