I have a question for you regarding GZip.
I have some dynamic forms created in .Net. Now I would like to have my form data (html + java script) gzipped and kept in database. so when the user request the form (JQuery Ajax) i can serve the gzipped version. I tried with GZipStream.but had no luck.
Any thoughts??
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
byte[] byteArray = new byte[value.Length];
byteArray = encoding.GetBytes(value);
//Prepare for compress
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.IO.Compression.GZipStream sw = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Compress, true);
//Compress
sw.Write(byteArray, 0, byteArray.Length);
//Close, DO NOT FLUSH cause bytes will go missing...
sw.Close();
System.Text.StringBuilder sB = new System.Text.StringBuilder();
byte[] finalData = ms.ToArray();
ms.Close();
sw.Dispose();
ms.Dispose();
sB.Append(encoding.GetString(finalData));
//Response.ClearContent();
//Response.OutputStream.Write(ms.ToArray(), 0, ms.ToArray().Length);
return sB.ToString();
Thanks, Shiras