C
Chan
Got in a difficult situation of storing and retrieving TextReader in
Cache, but found no such post yet.
Tried to store a textreader into Cache object in a similar way
illustrated in .NET's SDK doc ("Retrieving Values of Cached Items"):
' -----------------------------
...
Dim CPCache As textreader = CType(Cache("CP"), textreader)
If CPCache Is Nothing Then
...
Dim txtrd As TextReader = ... ' get something to fill the txtrd.
Cache.Insert("CP", txtrd)
' display txtrd's content on the page
divTag.InnerText = "New!!! " & txtrd.ReadtoEnd
Else
divTag.InnerText = "Cache exists! " & CPCache.ReadtoEnd
End If
' -----------------------------
Web page displayed the txtrd content when it ran the first time as:
New!!! ..... (content of txtrd, all normal char as expected)
Then showed:
Cache exists!
It's verified the length of CPCache's content is zero in Cache. But no
error returned.
However, replacing "txtrd" (TextReader) with "str" (string) and
appropriate methods, content of "str" is shown correctly following
"Cache exists! " on the page.
Does anyone have any experience of TextReader in Cache?
Thanks.
Cache, but found no such post yet.
Tried to store a textreader into Cache object in a similar way
illustrated in .NET's SDK doc ("Retrieving Values of Cached Items"):
' -----------------------------
...
Dim CPCache As textreader = CType(Cache("CP"), textreader)
If CPCache Is Nothing Then
...
Dim txtrd As TextReader = ... ' get something to fill the txtrd.
Cache.Insert("CP", txtrd)
' display txtrd's content on the page
divTag.InnerText = "New!!! " & txtrd.ReadtoEnd
Else
divTag.InnerText = "Cache exists! " & CPCache.ReadtoEnd
End If
' -----------------------------
Web page displayed the txtrd content when it ran the first time as:
New!!! ..... (content of txtrd, all normal char as expected)
Then showed:
Cache exists!
It's verified the length of CPCache's content is zero in Cache. But no
error returned.
However, replacing "txtrd" (TextReader) with "str" (string) and
appropriate methods, content of "str" is shown correctly following
"Cache exists! " on the page.
Does anyone have any experience of TextReader in Cache?
Thanks.