asp.net-core.net-coredownload

Is there an issue with downloading a zip file under .NET Core?


I have a problem downloading a zip file with .NET Core. I have a function that works locally. As soon as I publish it, I get this error:

Web error from GoDaddy

The controller looks like this:

public class SpecialController : Controller
{
    public IActionResult Index()
    {
        return View();   
    }

    public FileResult Download()
    {
         var fileName = "TCProjects.zip";
         var stream = new FileStream("zipfile/TCProjects.zip", FileMode.Open);
         return File(stream, "application/zip", fileName);
    }
}

I am using an action link in the Special View like this:

<a href="@Url.Action("Download")">DownLoad TCProjects</a>

As soon as I select this link, I get the error. I have not had much experience downloading files in net core so I am a bit lost on how to correct this.


Solution

  • After many attempts to resolve this, I realized I was having a server issue regarding permissions. The website on the server was changed to use a user pool.