LoginSignup
0
0

More than 5 years have passed since last update.

ASP.NET WebAPIについてのメモ

Last updated at Posted at 2018-12-06

コントローラー

ApiController

戻り値の型

  • void
    • 204(No Content)を返す
  • HttpResponseMessage
    • HTTPのレスポンスメッセージを直接返す
  • IHttpApplicationResult
    • ExecuteAsyncを作成する。HttpResponseMessageレスポンスに変換する
  • その他
    • MediaFormatterで戻り値をシリアル化する
    • ContentResultで返すと第2引数でContent-Type、第3引数で文字エンコーディングを指定できる。

MediaFormatter

MIMEの種類

  • text/plain
  • text/html
  • text/csv
  • image/png
  • application/json
  • application/octet-stream
  • application/pdf
  • application/x-www-form-urlencoded
    • POSTメソッドによるフォームデータの送信

Content-Transfer-Encoding

TransferEncodingを設定する
- Base64
- EightBit
- QuotePrintable
- SavenBit
- Unknown

参考:
https://docs.microsoft.com/ja-jp/dotnet/api/system.net.mime.transferencoding?view=netframework-4.7.2
https://docs.microsoft.com/ja-jp/aspnet/web-api/overview/formats-and-model-binding/media-formatters
https://docs.microsoft.com/ja-jp/aspnet/web-api/overview/formats-and-model-binding/media-formatters
https://ja.wikipedia.org/wiki/Multipurpose_Internet_Mail_Extensions
http://www.atmarkit.co.jp/ait/articles/0907/10/news109_2.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0