Error while reading the contents of txt file using Silverlight 3.0

Jun 29, 2009 at 3:35 PM


I am using Silverlight 3.0 and WCF service to read the contents of .txt file and then send it to the server. I am getting the error namely "Attempt to access the method failed: System.IO.StreamReader..ctor(System.String)" while executing the following code:

Dictionary<String, string> objAttachDocArgs = new Dictionary<String, string>();

StreamReader myReader = new StreamReader(FileDialog.File.Name);

objAttachDocArgs.Add(AttachCounter++ + "_" + FileDialog.File.Name, myReader.ReadLine());

Here 'objAttachDocArgs' is a Dictionary type of object through which I want to send the contents of a txt file to the server.


Please let me know where iam missing.

Thanks in advance

Jun 30, 2009 at 11:26 AM

I think you would be better placing this question on the Silverlight discussion forum.