public async Task <IActionResult> OnGetLogFile(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.GetLogFile(directory, name); if (file == null) { return(BadRequest()); } return(File(file.OpenRead(), "application/text", file.Name)); }