在分析完成之前就遇到流结尾?
public static object ByteToObject(byte[] bytes)
{
System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);
System.Runtime.Serialization.IFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
Object reobj = bf.Deserialize(stream);
stream.Close();
return reobj;
}
在分析完成之前就遇到流结尾。
怎么回事
------解决方案--------------------把这句加在Deserialize那句之前试试:
stream.Position = 0;
------解决方案--------------------
------解决方案-------------------- Response.ContentEncoding = System.Text.Encoding.Default;
Response.ContentType = "rar";
Response.AddHeader("Content-Disposition", "attachment; filename=" 1.rar");
Response.BinaryWrite(bytes);