我正在尝试从网址下载CSV文件,但是,响应如下所示:
"\"\0T\0r\0a\0n\0s\0a\0c\0t\0i\0o\0n\0_\0I\0D\0\"\0,\0\"\0S\0t\0a\0t\0u\0s\0\"\
我可以确认该网址有效,我收到了一个CSV文件。以下是它的一部分:
" TRANSACTION_ID""状态"" Closed_By"" Payment_Type"" Date_Submitted"&# 34; Date_Scheduled",
我的代码不正确吗?为什么我没有收到以逗号分隔的列表?
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(reportLink);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
// open the file "data.csv" which is a CSV file with headers
using (CsvReader csv = new CsvReader(sr, true))
{
int fieldCount = csv.FieldCount;
csv.MissingFieldAction = MissingFieldAction.ReplaceByEmpty;
string[] headers = csv.GetFieldHeaders();
while (csv.ReadNextRecord())
{
}
}