Save dialog box to download file, Saving file from ASP.NET server to the client

前端 未结 5 947
谎友^
谎友^ 2020-12-01 21:59

I\'ve been searching around the internet, but couldn\'t find any useful answer.

I have an ASP.NET web site, which is deployed on server. The ASP.NET web site on the

5条回答
  •  温柔的废话
    2020-12-01 22:47

    Get file contents in byte[] from W drive and write it to local file.

    byte[] data = File.ReadAllBytes(WDriveFilePath)
    
    FileStream file = File.Create(HttpContext.Current.Server.MapPath(MyLocalFile)); 
    
    file.Write(data, 0, data.Length); 
     file.Close(); 
    

提交回复
热议问题