SessionStateItemCollection.Deserialize Method (BinaryReader)
Creates a SessionStateItemCollection collection from a storage location that is written to using the Serialize method.
Assembly: System.Web (in System.Web.dll)
Public Shared Function Deserialize ( reader As BinaryReader ) As SessionStateItemCollection
Parameters
- reader
-
Type:
System.IO.BinaryReader
The BinaryReader used to read the serialized collection from a stream or encoded string.
Return Value
Type: System.Web.SessionState.SessionStateItemCollectionA SessionStateItemCollection collection populated with the contents from a storage location that is written to using the Serialize method.
| Exception | Condition |
|---|---|
| HttpException | The session state information is invalid or corrupted |
The Deserialize method can be used to read the contents of a SessionStateItemCollection collection from the session store.
To write the contents of a SessionStateItemCollection object to the session store, use the Serialize method.
The following code example creates a SessionStateItemCollection collection from a file that was created using the Serialize method.
Dim reader As System.IO.BinaryReader = New System.IO.BinaryReader( _ System.IO.File.Open(Server.MapPath("session_collection.bin"), System.IO.FileMode.Open)) Dim sessionItems As SessionStateItemCollection = SessionStateItemCollection.Deserialize(reader) For I As Integer = 0 To sessionItems.Count - 1 Response.Write("sessionItems(" & i & ") = " & sessionItems(i).ToString() & "<br />") Next
Available since 2.0