关于Response.OutputStream的问题
我用Response.OutputStream来提供zip文件的下载,但是当将一个mxml(Flex Builder生成的类似xml的文件)文件添加到zip当中时,IE提示说"The XML page cannnot be displayed....Cannot view XML input using style sheet.....An invalid character was found in text content",为什么会出这种问题啊?既然打包成zip文件了编译器就应该不关心zip里面的内容了呀?code:
using (Package p=Package.Open("d:\\Client.zip",FileMode.Create))
{
p.PackageProperties.ContentType=MediaTypeNames.Application.Zip;
PackagePart pp1=p.CreatePart(PackUriHelper.CreatePartUri(new Uri("a.mxml",UriKind.Relative)),
MediaTypeNames.Text.Richtext);
byte[] d_str=Encoding.UTF8.GetBytes(f_mxml); //string f_mxml="<application ....."
pp1.GetStream(d_str,0,d_str.Length);
}
byte[] data=File.ReadAllBytes("D:\\Client.zip");
File.Delete("d:\Client.zip");
Response.ContentType=MediaTypeNames.Applications.Zip;
Response.ContentEncoding=Encoding.UTF8;
Response.BufferOutput=true;
Response.OutputStream.Write(data,0,data.Length);
Response.Flush();
补充:.NET技术 , .NET Framework