locked
Accessing local hardware RRS feed

  • Question

  • We are planning to use a Silverlight2 application to access a USB security key to allow accessing data and writing data to this key.

    It will be plugged into the client side computer. The data from the key will be sent to the website for processing.

    Is it possible to access local hardware, specifically a USB key, from a Silverlight2 application?

    This approach is central to our design decision.

    Any help would be greatly appreciated.

    --John

     

    Sunday, September 21, 2008 10:50 AM

Answers

All replies

  • If the key shows up as a removable drive on the system, you should be able to access files on the key through the use of the file open dialog, which would require the end user to navigate to some file on the USB key.  For security reasons, your Silverlight application cannot have direct access to the client's file system without the end user's consent.  Note that the file open dialog is read only, so you won't be able to save data directly to your USB key through Silverlight.  You can only write data to isolated storage, and this is limited to 1 MB.  I hope that this helps to answer your question!

    Sunday, September 21, 2008 11:35 AM
  • Thanks for the input.

    Is there any way for the Usere to give the Silverlight App permission to access the Usb key for both read and write. I understand that this cannot be done without the User's consent but how can he give that consent so the program can perform operations (read/write) on the key.

    We are trying to keep this a fully Silverlight2 App. We realize that we could use a WinForm and perform read/write on the key but it would be a great advantage to having everything in the Silverlight2 App. Having the User enter their Windows login password would not be a problem.

     Any suggestions would be appreciated.

     

    --John

     

    Sunday, September 21, 2008 12:19 PM
  • Currently, you can only write data to isolated storage.  So you'll need to design a solution with this constraint in mind.  It's not clear if writing files will ever be supported.  This link talks about reading and writing files in more detail:

    http://www.silverlightexamples.net/post/Open-File-Dialog-in-Silverlight.aspx 

    I hope that this helps!

    -Ken 

    Sunday, September 21, 2008 1:40 PM
  • No, there is currently no way to give a Silverlight Application access to anything other than readonly access through the OpenFileDialog as already described, or to IsolatedStorage.

     

    Sunday, September 21, 2008 6:50 PM
  •  

    I appreciate all the inputs. It clarifies the situation for us.

    It means that we will not be able to use Silverlight for this product.

    One observation. Much of the literature on the web today talks about the move from local applications to web based applications. It would appear that the fact one cannot access local hardware (even with full consent of the user) is inconsistent with the objective of moving applications to the web. The ability to access local hardware (both read and write) is essential to many if not most applications. This will prevent Silverlight from being used as a means for moving applications to the web. The basic aspects of  Silverlight are so appealing (web applications that marry Xaml and managed code) that this lack is a bit of a surprise.

    Again, thanks for the help.

     

    --John

    Monday, September 22, 2008 11:47 PM
  • Note that flash and java applets will have similar restrictions for the same reason.  If you need to access local hardware, you should consider building a windows application.

    -Ken 

    Tuesday, September 23, 2008 10:18 AM
  • We realize that. What we acting on is that in Silverlight2Beta1 it was possible to wirte to a local file. We created a App that did so. The change from Beta1 to Beta2 was not expected.

     Our objective was to have sales people anywhere on the internet (though probably within a Vpn) to be able to "recharge" their Usb key locks (which would allow a user to make use of our software for a specific period while uploading usage information stored in the key) just using the web. We wanted to avoild requiring them to use a computer with a specific Windows application installed .

    --John

     

    Tuesday, September 23, 2008 12:25 PM
  • I see your dilemma.  I can't speak for microsoft, so I can't say whether or not they'll bring that feature back.

    Would it be possible to generate a file on the server side that your sales people could save directly to their USB drives by using the browser's "Save File" dialog?  I'd imagine that a solution along those line could work for you.

    -Ken 

    Tuesday, September 23, 2008 12:50 PM
  • It would solve the client to server side but not reseting the internals of the key from the server side.

    Thanks.

    --John

    Tuesday, September 23, 2008 2:30 PM
  •  I would solve this problem like Microsoft solved their updater process.  Build the app and UI in Silverlight.  Build a helper service that gets installed on the local machine.  Have SL talk to that service via localhost:someport.  They will have to install the app obviously on their machines....  The other way you can do this is to prompt the user to download an EXE file. Have them run the EXE file which will recharge their usb key.

    Saturday, August 29, 2009 11:01 PM