ASP.NET Web フォームアプリケーションがあります。ユーザーがダウンロード リンクをクリックしたら、その場でいくつかのXMLファイルを作成し、それらを圧縮して、ユーザーにダウンロード ダイアログを表示する必要があります。
単一の XML ファイルをダウンロードする関数を既に作成しており、正しく動作します。download.aspxファイル内のリンクは次のとおりです。
<asp:HyperLink ID="hlDownload" Text="Download" NavigateUrl='<%# String.Format("GetFile.aspx?LicenseGuid={0}", Eval("ProductId")) %>' runat="server"></asp:HyperLink>
GetFile.aspxコード ビハインドの関数:
Dim xmlFile = _productServices.GetXMLFilePerProductId(ProductId)
Dim xdoc As XmlDocument = New XmlDocument()
xdoc.LoadXml(xmlFile)
Response.Clear()
Response.ContentType = "text/xml"
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.AddHeader("Content-Disposition", "attachment; filename=some_name.xml")
xdoc.Save(Response.Output)
Response.End()
オンザフライで ZIP ファイルを作成し、オンザフライで作成されたいくつかの XML ファイルをパックするにはどうすればよいですか?
PS: C# と VB.NET の両方での回答を歓迎します