views:

1016

answers:

4

We have a working WPF app that we are looking into running in the browser via Silverlight. The big question mark right now is; what kind of file access will we have (without jumping thought to many hoops)?

  • Can we open server-side files?
  • Can we open client-side files?
  • Can we get change notification on files (client or server side)?
  • Can we do the normal open/seek/write/append operations?

(Good link welcome as answeres)


  • This looks relevant for the client side stuff, as with the follow up/correction
  • Haven't found anything about loading file from the server.
A: 

Make it XBAP and deploy it as full trust

What kinda app are you having???? first tell that and we can work the conclusions out!

UPDATE

abmv
The non silverlight app is just an app that opens, read, updates and monitors files. If answering my question needs more info than that, then I suspect either you are not answering the question I think I'm asking or silverlight isn't close enough to WPF to do what we need.
BCS
Those cover the client side...
BCS
You need to rework your architecture...you could implement web-services and some polling client or something with WCF thrown in....up to you, your core will work,ui can display stats
abmv
Fud, If that's all silverlight gets us, then we can get up and running with a thick client just as fast, if not faster.
BCS
A: 

You won't be able to manipulate local files with silverlight without rich client side component. That client side componetn must expose web service API and behave like local web server. With that aproach you can do almost everything that regular WPF app can do.

I don't understand. Why would the client side code need to expose a web service? Who would call it? What would it do? In everything my app is supposed to do *it* is the instigator. It needs to load local files. It needs to load files from the server. No one but the user at the keyboard gets to ask it to do anything.
BCS
In any event it's wrong. You can't open a WCF service with Silverlight on the client side (duplex contracts aside). Even with duplex contracts the endpoint is still running under Silverlight, with it's security model and the limitations it imposes.
blowdart
It's known technic, if you want to access local resources from you silverlight app, you can have local http server, your silverlight app will call web service running on that server and server would do whatever you need to do with your system.
OK so your suggestion is rather than stick with WPF you now introduce a dependency on a web server, be it IIS or Cassini, just to access local files? Even then the web server would have to run as Local System to get access to everywhere, it would be a rather big point of attack for, well, anything
blowdart
A: 
  1. "Can we open server-side files?" - Yes, but requires a web service (edited)
  2. "Can we open client-side files?" - Yes, only via an Open File window or files in isolated sotrage
  3. "Can we get change notification on files (client or server side)?" - Yes, but only on server side.
  4. "Can we do the normal open/seek/write/append operations?" With System.IO.FileStream class, which is available in Silverlight, you can manipulate textual streams in memory. However, you need to fetch the stream by web services, opening it with file open window, or from isolated storage.
Przemek
Disagree with point #1. It is important to note that in order to open server files you need to use WebClient or a Web Service call in order to pull the data down to the client. Without providing this disclaimer, you are implying that File.Open(...) gives me access to server-side files as it does with ASP.NET (which actually runs on the server).
markti
Good clarification: the wrong implication is what I was hoping would work.
BCS
@markti Although I did not give an explanation I was still correct by saying that it is possible to open server-side files in silverlight. Of course it is not as simple as using local File.Open but nevertheless it IS possible (by dragging the file using a web service, as you say). I was definitely not trying to imply that one can get direct access to server files.
Przemek
direct access to server files is what I wanted and needed so #1 is wrong, misleadings or irrelevant, depending on how you look at it.
BCS
@BCS I appreciate that you have clarified it now. However, it wasn't crystal clear in your original question and hence the content of my answer is what it is. I should not be penalized for the misunderstanding.
Przemek
+2  A: 
  1. Server Side Files : No, unless you serve them via a web service.
  2. You can open files in two ways. One is isolated storage, an area that your application has, of limited size (although you can ask the user for an increase). In this you can read, write and do what you want. If you want hard disk access then you can only read, and the file must be opened from a file open dialog.
  3. If you mean via a FileSystemWatcher - no, not even in isolated storage. Server side you can do what you want, obviously, because it's not Silverlight there. You can use duplex web services so the server could notify your silverlight application when something happens like a file change.
  4. In isolated storage you can do what you want. Outside of that it is read operations only and the user must choose a file from the File Open dialog.
blowdart