How Did This Get Here, I Am Not Good With Computers

SharePoint | .NET | SQL | Web & Application Development

  Home  |   Contact  |   Syndication    |   Login
  11 Posts | 0 Stories | 18 Comments | 0 Trackbacks

News

All statements in this blog are my personal opinions and do not reflect the opinions of my employer.

Locations of visitors to this page

Add to Google Reader or Homepage

 Subscribe

Tag Cloud


Archives

Post Categories

Wednesday, April 22, 2009 #

I ran into a situation where I was storing files in a database as a binary field. Some of these files were in HTML format and I wanted to dynamically display them inside of some ASP pages I was developing. After a bit of research I was finding a lot of other solutions people were using involved timestamp conversions which were not ASCII based like HTML. The following code will convert your binary object into ASCII and display it as it was originally uploaded.
byte[] myByteArray = myBinaryObj.ToArray();
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
string result = enc.GetString(myByteArray);