BinaryFormatter Alternatives with limitied security priviledges

P

Phil Jones

I want to write class that effectively caches object state between instances
of a WindowsForms application running.



The obvious device to use is the [BinaryFormatter] within the
Runtime.Serialization namespace.



However, I would also like the class to be operable within a
No-Touch-Deployment instance, which means I want to work within the
IsolatedStorage container, and within the "Internet Zone" I'm not allowed to
use the [BinaryFormatter] because of the limited permission set.



Is there another way to save and restore the an object instance that is
usable within a limited security context?



Thanks anyone?
 
P

Phil Jones

Cheers,

I've read up on it, and basically the formatter throws an exception at
construction if it doesn't have enough priveledges. Just 'aint no way to
do' binary with out the security pass.

Thanks...
 
P

Phil Jones

Here's some code:


REM -- Setup initial conditions.
Dim myThingToStore As New ArrayList
myThingToStore.Add("My Name")

REM -- Get the isolated storage file.
Dim fileName As String = "WebStorage.bin"
Dim isoStore As IsolatedStorageFile
Dim oFile As New IsolatedStorageFileStream( _
fileName, FileMode.Create, isoStore)

REM -- Serialize the stream.
Dim oFormatter As New Formatters.Binary.BinaryFormatter
oFormatter.Serialize(oFile, myThingToStore)
oFile.Close()


This will work if executed from the local machine, but will fail at the
"Serialize" call if run from the Internet ("Low" security priveledge).

Basically I want to cache object state between instances of a Forms app that
is executing within the "NTD" model (hence the need to use IsolatedStorage).

Any ideas for a work around? Thanks....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top