|
|
|
asp.net c# ต้องการให้เขียนลง textfile แล้วดาวโหลดออกมาโดยให้ถามที่จัดเก็บก่อน |
|
|
|
|
|
|
|
ลองดูตัวนี้ครับ
(C#) ASP.NET Create Text File
|
|
|
|
|
Date :
2017-05-11 10:01:03 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วตอนดาวโหลดอ่าครับ
|
|
|
|
|
Date :
2017-05-11 19:53:55 |
By :
kenghockey |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition",
"attachment; filename=" + fileName + ";");
response.TransmitFile(Server.MapPath("text.txt"));
response.Flush();
response.End();
|
|
|
|
|
Date :
2017-05-12 11:01:49 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (VB.NET)
Dim response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
response.ClearContent()
response.Clear()
response.ContentType = "text/plain"
response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";")
response.TransmitFile(Server.MapPath("text.txt"))
response.Flush()
response.End()
|
|
|
|
|
Date :
2017-05-12 11:02:55 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|