Wednesday, February 11, 2004 - Posts

Memphis DevDays Speakers

It's official.  You can now go to the DevDays site and see the list of local speakers.  As I said in a previous post, I know most of these guys personally.  I would make every effort to go see these guys.  Remember, there are two tracks; Smart Client and Web Development.

Come see me present session 2 of the Web Track.  In this session, entitled “Threats and Threat Modeling - Understanding Web Application Threats and Vulnerabilities”, I get to show you how most web sites contain insecure code

I can't wait to see you there.  I get to scare your pants off!

Use Isolated Storage for Configuration Data

When storing user-specific program settings, I like using the Isolated File Storage capability of Windows and .NET.  This allows a program to place files into a location that is specific to that user and assembly.  Here's how:

Saving:
Dim isoFile As IsolatedStorageFile
Dim isoStream As IsolatedStorageFileStream
Dim bf As BinaryFormatter
Dim optMap As Hashtable
 
optMap = New Hashtable()
optMap.Add(“Key1”, 12)
optMap.Add(“Key2”, 20)
 
isoFile = IsolatedStorageFile.GetUserStoreForAssembly
isoStream = New IsolatedStorageFileStream(“MyApp.cfg”,_ IO.FileMode.Create, isoFile)
bf = New BinaryFormatter()
bf.Serialize(isoStream,optMap)

Loading:
Dim isoFile As IsolatedStorageFile
Dim isoStream As IsolatedStorageFileStream
Dim bf As BinaryFormatter
Dim optMap As Hashtable
 
isoFile = IsolatedStorageFile.GetUserStoreForAssembly
isoStream = New IsolatedStorageFileStream_(FILENAME,IO.FileMode.OpenOrCreate, isoFile)
 
If isoStream.Length > 0 Then
bf = New BinaryFormatter()
      optMap = CType(bf.Deserialize(isoStream),Hashtable)
 
      x = CType(optMap(“Key1”),integer)
      y = CType(optMap(“Key2”),integer)
EndIf