【发布时间】:2019-12-10 05:28:30
【问题描述】:
我目前正在从注册表单中获取输入并将输入详细信息下载为文本文件。下载的文本文件结果是:JimJone03/09/1998 00:00:00xxx@gmail.com 230436315
我希望结果以列格式显示。
例如:
吉姆·琼斯
03/09/98
xxx@gmail.com
+23057xxx556
这是我尝试过的:
public ActionResult Create(Information information)
{
var byteArray = Encoding.ASCII.GetBytes(information.FirstName + ""
+ information.Surname + "" + information.DOB + ""
+ information.Email + " " + information.Tel);
var stream = new MemoryStream(byteArray);
return File(stream, "text/plain", "your_file_name.txt");
}
【问题讨论】:
-
这能回答你的问题吗? Save and load MemoryStream to/from a file
-
并非如此。保存在文本文件中的数据需要采用列格式。它实际上是水平格式,没有空格
标签: asp.net asp.net-mvc model-view-controller