Skip to main content

Microsoft Silverlight

Answered Question Save folder and files under C:\\RSS Feed

(0)

Silverlight Web Developer
Silverli...

Member

Member

74 points

308 Posts

Save folder and files under C:\\

I know that Silverlight has a limitation to not write and read files from C:\\ and by this use Isolated storage as I do now.

What also should work is to use Open and FileDialog.

My question is this. I recently was on a webpage where I pressed a Button. Before I did this I had to install Javascript on my computer.

When pressing this button 1 folder was created under C:\\ that consists of 10 files and a folder that also have 5 files inside.

 

How was this possible. Perheps there is any kind of workaround to read and write files from C:\\ without using FileDialogs ?

Fredrik N
Fredrik N

Participant

Participant

1052 points

211 Posts

Answered Question

Re: Save folder and files under C:\\

There is no workaround. If a Silverlight app could just create folders and files on your disc, everyone could write apps that just removes, add virus etc to your computer.

The Button was on a normal Web page?

You mention something about installing Javascript, I guess what you did was installing something on your computer that wasn't a JavaScript (Javascript is supported by the browser, nothing that you need to install)?! Instead someone that just tricked you to make sure you installed an app that created the files on your harddrive.. So I will call that a virus.

/Fredrik Normén - fredrikn @ twitter

ASPInsider

Microsoft MVP, MCSD, MCAD, MCT

ASPInsiders
My Blog

Silverlight Web Developer
Silverli...

Member

Member

74 points

308 Posts

Re: Save folder and files under C:\\

No one tricked me and this is not a virus. This is from a very large and known company.

I remove the folder that was created and then I press their button again at their webpage wich is a normal web page. When I click the button, the folder is again created with the files under C:\\

So in somehow, this is possible to do. The question is how this is possible. I dont know if Javascript had or have something to do with this. Anyway this is a possibility to do and I haven´t downloaded any install file that could have been creating this folder and files.

It comes right from that button on the webpage.

pbromberg
pbromberg

Contributor

Contributor

2114 points

368 Posts

Re: Save folder and files under C:\\

It's possible with an ActiveX control if you approved its installation. It is not possible with Silverlight.

Silverlight Web Developer
Silverli...

Member

Member

74 points

308 Posts

Re: Save folder and files under C:\\

Okay, I have to ask. I am not familiar with the ActiveX control but would it be possible to combine the ActiveX control and Silverlight and Read and Write files to C:\\ in somehow.

Is there any way to achieve this. To let a user install whatever is necessary like the ActiveX control to be able to do this ?

pbromberg
pbromberg

Contributor

Contributor

2114 points

368 Posts

Re: Save folder and files under C:\\

No, it is not possible. Silverlight has no knowledge of COM and ActiveX

sl.ayer
sl.ayer

Participant

Participant

848 points

162 Posts

Re: Save folder and files under C:\\

You could do things not permitted by Silverlight if you get user to install ActiveX control. Silverlight app would need to use javascript as a bridge to talk to ActiveX control. Of cause using ActiveX kills portability and puts use of Silverlight in question. If you have to resort to ActiveX then why not simply go with xbap?

Fredrik N
Fredrik N

Participant

Participant

1052 points

211 Posts

Re: Save folder and files under C:\\

If you create or use a ActiveX which will access the local disc, you have to make sure your clients want to install that ActiveX, I would never install such AxctiveX on my computer. So It's much better if you let the users save the files by using the Save Dialog or Open to open files. If you need to store something and don't want use the Save dialog, use the IsolatedStorage, or use a Service and put the files into a database.

/Fredrik Normén - fredrikn @ twitter

ASPInsider

Microsoft MVP, MCSD, MCAD, MCT

ASPInsiders
My Blog

Silverlight Web Developer
Silverli...

Member

Member

74 points

308 Posts

Re: Save folder and files under C:\\

Thanks for your answers.. The ActiveX control do sound interesting to explore. The thing is that the application is built on very much data as Gigabytes, so a database would not be possible.

For the moment I do use the Isolated Storage but are also thinking of an approach or possibitlity to also use for example: C:\\ as reading and writing this information.

I will not implement these logics for the moment but it is good to have the knowledge that this is a possibility when developing all searchpaths etc in the application.

Thanks..

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities