I moved my ASP.NET Core 6 MVC Web application from IIS to Ubuntu 22.04 using Apache2 as the webserver. The only issue I have is the select dropdown is not showing the pdf name files in order after moving the web app to Ubuntu. When using localhost in visual studio files show in order and IIS in Windows on a live server.
I'm not sure why this is happening. Is it an Ubuntu issue. Below is the method to add the files to the select dropdown.
Any help would be much appreciated.
public static UserFile GetPdfFiles(UserFile userFile, string webRootPath, string fileDirectoryPath)
{
string fullPath = $"{webRootPath}{fileDirectoryPath}";
int nId = 1;
userFile.Files = new List<SelectListItem>();
foreach (string pdfPath in Directory.EnumerateFiles(fullPath, "*.pdf"))
{
userFile.Files.Add(new SelectListItem
{
Text = Path.GetFileName(pdfPath),
Value = nId.ToString(),
});
nId++;
}
int listCount = userFile.Files.Count - 1;
userFile.Name = userFile.Files[listCount].Text;
userFile.Path = fileDirectoryPath.Replace('\\', '/');
return userFile;
}
Ubuntu
Windows/locahost

