0

Friends, I have a requirement I am given a text file with fixed number of columns but row varies, I should read that and populate that in grid/table using Silverlight. The text file will have data something like this:

0, 0, 2, 1, "url1", description1 
1, 0, 2, 2, "url2", description2 
1, 1, 4, 2, "url3", description2

As we can see columns are fixed but row can vary.

Now I want my Silverlight app to read this file from system and populate in grid/table like:

RowNo ColumnNo Width Height ImageURL Description 

0        0       2     1       url1  Description1 
1        0       2     2       url2  Description2 
1        1       4     2       url3  Description3

I tried reading the file using Streamreader but it's showing SecurityException error SecurityExceptionHandler was unhandled by user code File operation not permitted. Access to path "c:\path\file.txt" is denied.

4

1 回答 1

3

You cannot access the filesystem directly for security reasons, unless the Silverlight application runs in Out-Of-Browser mode.

In a Silverlight web application, accessing the filesystem can be done only when the user initiates such an action. See How to: Use the Open File Dialog Box on MSDN.

于 2012-12-16T10:52:50.227 回答