Azure ZIP multiple files using Shared Access Signature and download from stream
<h2>Is it somehow possible to zip multiple files directly to the output stream using Shared access signature and then send it to user?</h2>

<hr>

<p>I'm using <a href="https://azure.microsoft.com/sv-se/documentation/articles/storage-dotnet-shared-access-signature-part-1/" rel="nofollow noreferrer">Shared Access Signatures</a> for downloading blobs from my blobstorage and <a href="http://DotNetZip" rel="nofollow noreferrer">DotNetZip</a> for zipping the blobs, (or trying atleast).</p>

<pre><code>   var images = _fileService.GetImages(companyID, model.ImageIDs).ToList();

        if (images != null &amp;&amp; images.Count &gt; 0)
        {
            DateTime currentTime = TimeZoneExtensions.GetCurrentDate();

            using (ZipFile zip = new ZipFile())
            {
                MemoryStream output = new MemoryStream();

                foreach (var image in images)
                {
                    if (image.ImageLinks != null)
                    {
                        //ImageLinks contains SAS uri for each image format..
                        List&lt;ImageLinkModel&gt; imageLinks = image.ImageLinks.Where(m =&gt; m.FormatID == model.FormatID).ToList();

                        if (imageLinks != null &amp;&amp; imageLinks.Count &gt; 0)
                        {
                            foreach (var imageLink in imageLinks)
                            {
                                if (String.IsNullOrEmpty(imageLink.DownloadURL) || imageLink.DateExpiresDownloadURL &lt; currentTime)
                                {
                                    int hours = 1;

                                    imageLink.DateExpiresDownloadURL = currentTime.AddHours(hours);

                                    //Create new shared access signature
                                    imageLink.DownloadURL = _fileService.GetDownloadImageURL(imageLink.BlobName, image.ImageName, hours);

                                    //Update imagelink
                                    _fileService.UpdateImageLink(companyID, imageLink);

                                    //Exception here
                                    zip.AddDirectory(imageLink.DownloadURL);
                                }
                                else
                                {

                                    //Use existing SAS download url

                                    Exception here
                                    zip.AddDirectory(imageLink.DownloadURL);
                                }
                            }

                            zip.Save(output);
                        }
                    }
                }

                return File(output, "application/zip", "sample.zip");
            }
        }
</code></pre>

<p>This is what I have come up with so far.</p>

<p>When running this method and adding a file to the zip I get the exception:
<code>System.ArgumentException URI format not supported</code>. I assume you can only add local path to the zip which makes sense, so now I'm out of ideas.</p>

<p>This is one of my SAS URLs:</p>

<p><a href="http://mystorage.blob.core.windows.net/images/22201642127PM625F493A7418BA855265516DF8038?sv=2015-04-05&amp;sr=b&amp;sig=%2FdNy6l6qyn7H1fh4D8T1Rd7emzgs%2B4GgQFlPoCOwBW4%3D&amp;st=2016-02-05T09%3A35%3A04Z&amp;se=2016-02-05T10%3A50%3A04Z&amp;sp=r&amp;rscd=Attachment%3B%20f" rel="nofollow noreferrer">http://mystorage.blob.core.windows.net/images/22201642127PM625F493A7418BA855265516DF8038?sv=2015-04-05&amp;sr=b&amp;sig=%2FdNy6l6qyn7H1fh4D8T1Rd7emzgs%2B4GgQFlPoCOwBW4%3D&amp;st=2016-02-05T09%3A35%3A04Z&amp;se=2016-02-05T10%3A50%3A04Z&amp;sp=r&amp;rscd=Attachment%3B%20f</a>...</p>

<p>It's nothing wrong with the URL, (I can download without zipping).</p>

<p>Am I trying to do the impossible here? Am I forced to download the blobs the normal way like <a href="https://stackoverflow.com/questions/18852389/generate-a-zip-file-from-azure-blob-storage-files">this</a> and after that zip them?</p>

<p>Thanks</p>