MemoryStream请求与接收
Posted zengwangjing
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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();
以上是关于MemoryStream请求与接收的主要内容,如果未能解决你的问题,请参考以下文章