Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用c#和typescript从客户端下载文件,而不将其存储在服务器中_C#_.net_Typescript_.net Core - Fatal编程技术网

使用c#和typescript从客户端下载文件,而不将其存储在服务器中

使用c#和typescript从客户端下载文件,而不将其存储在服务器中,c#,.net,typescript,.net-core,C#,.net,Typescript,.net Core,我在应用程序中使用c#和typescript。我的数据库中有一个XML列,需要将其作为文件填充到客户端。我尝试将它作为文件存储在我的服务器上,然后下载,当它工作时,我不想在服务器上存储任何东西 string zipPath = $"{path}.zip"; if (System.IO.File.Exists(zipPath)) { System.IO.File.Delete(zipPath); } ZipFile.CreateFromDirectory(path,

我在应用程序中使用c#和typescript。我的数据库中有一个XML列,需要将其作为文件填充到客户端。我尝试将它作为文件存储在我的服务器上,然后下载,当它工作时,我不想在服务器上存储任何东西

string zipPath = $"{path}.zip"; 
if (System.IO.File.Exists(zipPath)) 
{
   System.IO.File.Delete(zipPath);
} 
ZipFile.CreateFromDirectory(path, zipPath); 
MemoryStream memory = new MemoryStream(); 
using (FileStream stream = new FileStream(zipPath, FileMode.Open)) 
{ 
    await stream.CopyToAsync(memory); 
} 
memory.Position = 0; 
fileStreamResult = File(memory, "application/zip", Path.GetFileName(zipPath));
这是我用来从服务器“下载”文件的代码。我想单独使用数据库和客户端,我不想在服务器上存储任何东西。请帮忙