我使用C#创建了一个可以下载文件的站点。致电后
//A webservice returning a stream with the document data.
Stream checkOut = FileProxy.RetrieveDocument(Ticket, ID);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.BufferOutput = true;
HttpContext.Current.Response.ContentType = "application/x-download";
HttpContext.Current.Response.AddHeader("Content-Disposition", "atachment; filename=" + filenamevariable);
HttpContext.Current.Response.CacheControl = "public";
byte[] buffer = new byte[255];
int butesRead = 0;
while ((bytesread = checkOut.Read(buffer, 0, 255)) > 0)
{
if(HttpContext.Current.REsponse.IsClientConnected)
{
HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length);
HttpContext.Current.Response.Flush();
}
}
Httpcontext.Current.Response.Close();
checkOut.Close();
运行此代码成功下载文档,但我无法继续使用该网站(按钮不再工作)。下载完成后我忘记了什么吗?