public async Task <IActionResult> OnGetFile(string directory, string name) { var user = await _userManger.GetUserAsync(User); if (user == null || user.Suspended) { HttpContext.Session.SetString("returnUrl", "servers/" + Id); return(RedirectToPage("signIn")); } var file = _factorioServerManager.GetSaveFile(directory, name); if (file == null) { return(BadRequest()); } return(File(file.OpenRead(), "application/zip", file.Name)); }