Upload File Server Error: Descriptor Invalid?

   public ActionResult FileLink(string hashname)
    {
        try
        {
            const string basePath = @"\\WINDHOVERDOCUMENTS\";
            const string adminSamples = @"Beta\students\";

            return File(basePath + adminSamples + hashname, "application/force-download", hashname);
        }
        catch (Exception)
        {
            return null; //no file
        }
    }

      

This action simply forces the download of the file when the action is triggered. Everything works fine. But after posting to the server, it gives me this error. Below is a screenshot. Can anyone please help? Thank. please zoom in to see screenshot. Unfortunately.

enter image description here

+3


source to share


1 answer


I figured that by reading the file into a byte array, return the result of the file contents



            var fileBytes = System.IO.File.ReadAllBytes(@"\\path\fileP12.zip");
            return File(fileBytes, "application/zip", "package.zip");

      

+3


source







All Articles