When reading a CSV file in DropBox using dotnet maui, the data becomes HTML instead of the contents of the CSV file.

康二郎 井上 60 評価のポイント
2024-08-21T12:47:33.4166667+00:00

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}"); }

開発者テクノロジ | C#
開発者テクノロジ | C#
C 言語ファミリをルーツとし、コンポーネント指向プログラミングのサポートを含む、オブジェクト指向およびタイプセーフのプログラミング言語。
{count} 件の投票

お客様の回答

質問作成者は回答に "承認済み"、モデレーターは "おすすめ" とマークできます。これにより、ユーザーは作成者の問題が回答によって解決したことを把握できます。