开发者

How do you Create a Disk from from a MemoryStream (VB.net)

I'm working on a project in VB.Net (2010) where I'm extracting files from an Document Management System.

The Files reside on the network, and information about the files are in a SQL 2005 Database and have been encrypted with the Encryption Stream (System.Security.Cryptography.RijndaelManaged)

I have retrieved the file, and decrypted them, but I'm trying to find out how to write the stream back to a file. I know the file type (which is stored in a SQL DB)

I can't find a solution in any of the VB files or the MS site.

Any h开发者_如何学运维elp would be appreciated.


To write a MemoryStream to a file just use the WriteTo method.

Using ms As MemoryStream = GetDecryptedMemoryStreamFromNetworkFile("network_file_path_goes here")
  Using fs As FileStream = File.OpenWrite("new_file_path_goes_here")
    ms.WriteTo(fs)
  End Using
End Using


Option 1 (obvious) is to create a temporary file on the disk.

Option 2 is to take something like our Callback File System product, which lets you do exactly what you need and many of our customers use it for scenarios like yours, i.e. represent data taken from document management systems and similar storages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜