1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MIMEタイプを直接書く以外で指定したい

Last updated at Posted at 2022-03-29

経緯

WebAPIなどで使用するMIMEタイプ。
普段C#では直接書いているけど、定数だし何かで定義されているのでは?と思って調べたので記録用に。

C#: System.Net.Mime

使いそうなのは以下の表に

呼び出し方 MIMEタイプ
MediaTypeNames.Application.Json application/json
MediaTypeNames.Application.Pdf application/pdf
MediaTypeNames.Application.Soap application/soap
MediaTypeNames.Application.Xml application/xml
MediaTypeNames.Application.Zip application/zip
MediaTypeNames.Image.Gif image/gif
MediaTypeNames.Image.Jpeg image/jpeg
MediaTypeNames.Text.Html text/html
MediaTypeNames.Text.Plain text/plain
MediaTypeNames.Text.Xml text/xml

感想

.Net Frameworkを使っているのですが、application/jsonが無くて使えなかったのが残念でした。
いつか使ってみたいと思いますが、使うのと使わないのとでは、どちらが良いのでしょうね…

1
0
1

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?