When reading a CSV file in DropBox using dotnet maui, the data becomes HTML instead of the contents of the CSV file.
康二郎 井上
60
評価のポイント
string fileUrl = "https://www.dropbox.com/scl/fi/sulx4lr91qy98a12pclzu/XXXX.csv?dl=1";
string localPath = Path.Combine(FileSystem.Current.AppDataDirectory, "XXXX.csv");
System.Diagnostics.Debug.WriteLine($"Local file path: {localPath}");
try
{ // download of the file
var response = await client.GetAsync(fileUrl);
response.EnsureSuccessStatusCode();
//
var fileBytes = await response.Content.ReadAsByteArrayAsync();
//
await File.WriteAllBytesAsync(localPath, fileBytes);
Debug.WriteLine("The download was successful."); }
catch (Exception ex)
{
Debug.WriteLine("Download failed.");
Debug.WriteLine($"Error: {ex.Message}"); }
サインインして回答する