差分
FilePathResultクラスとは、[[ASP.NET MVC]]の[[アクション・メソッド]]の戻り値([[ActionResult]]およびその派生クラス)として、ファイル名(ファイルパス)で指定されたファイルの内容をバイナリデータとしてそのまま送信する[[FileResultクラス]]を継承したクラスである。
== 使用例 ==
<source lang="csharp">
using System.Web.Mvc;
public class HomeController : Controller
{
public ActionResult DownloadCsv()
{
this.HttpContext.Response.AddHeader(
"Content-Disposition",
"attachment; filename=hello.csv");
return new FilePathResult("hello.csv", "text/csv");
}
}
</source>
== 関連項目 ==
* [[ActionResult]] - [[ASP.NET MVC]]のアクション・メソッドの戻り値として使うベースクラス。
** [[FileResult]] - ファイルをダウンロードさせるためのベースクラス。
*** [[FileContentResult]] - バイト配列をHTTPレスポンスに書き込む。
*** [[FilePathResult]] - 指定されたファイルパスの中身をHTTPレスポンスに書き込む。
*** [[FileStreamResult]] - [[Streamクラス]]の中身をHTTPレスポンスに書き込む。
* [[ASP.NET MVC]]
== 参考文献 ==
<references/>
== 外部リンク ==
* http://msdn.microsoft.com/ja-jp/library/system.web.mvc.filestreamresult.aspx
{{stub}}
== 使用例 ==
<source lang="csharp">
using System.Web.Mvc;
public class HomeController : Controller
{
public ActionResult DownloadCsv()
{
this.HttpContext.Response.AddHeader(
"Content-Disposition",
"attachment; filename=hello.csv");
return new FilePathResult("hello.csv", "text/csv");
}
}
</source>
== 関連項目 ==
* [[ActionResult]] - [[ASP.NET MVC]]のアクション・メソッドの戻り値として使うベースクラス。
** [[FileResult]] - ファイルをダウンロードさせるためのベースクラス。
*** [[FileContentResult]] - バイト配列をHTTPレスポンスに書き込む。
*** [[FilePathResult]] - 指定されたファイルパスの中身をHTTPレスポンスに書き込む。
*** [[FileStreamResult]] - [[Streamクラス]]の中身をHTTPレスポンスに書き込む。
* [[ASP.NET MVC]]
== 参考文献 ==
<references/>
== 外部リンク ==
* http://msdn.microsoft.com/ja-jp/library/system.web.mvc.filestreamresult.aspx
{{stub}}