MemoryStream请求与接收
//流请求
static void Main(string[] args)
string logpatch = “D:\Logs\”
if (!string.IsNullOrEmpty(logpatch))
{
if (!System.IO.Directory.Exists(logpatch))
{
System.IO.Directory.CreateDirectory(logpatch);
}
}
else
{
logpatch = System.AppDomain.CurrentDomain.BaseDirectory+ "Logs\\";
if (!System.IO.Directory.Exists(logpatch))
{
System.IO.Directory.CreateDirectory(logpatch);
}
}
logpatch = logpatch + System.DateTime.Today.ToString("yyyyMMdd") + "\\";
if (!System.IO.Directory.Exists(logpatch))
{
System.IO.Directory.CreateDirectory(logpatch);
}
byte[] bufferSteam = new byte[context.Request.InputStream.Length];
context.Request.InputStream.Read(bufferSteam, 0, bufferSteam.Length);
string strPath = logpatch + DateTime.Now.ToString("yyyyMMddHHmmsss")+"_" + strStoreTillid + ".xls";
FileStream fsSteam = new FileStream(strPath, FileMode.Create, FileAccess.Write);
BinaryWriter bwSteam = new BinaryWriter(fsSteam);
bwSteam.Write(bufferSteam);
bwSteam.Close();
fsSteam.Close();