ASP MVC - Are there any constants for the default content types?

前端 未结 7 1910
囚心锁ツ
囚心锁ツ 2020-12-04 09:53

Is there a set of constants in the framework for all the standard content types?

7条回答
  •  旧巷少年郎
    2020-12-04 10:22

    Taking it as a resounding no, I wrote my own. That's what Sundays were made for.

    ///Used to denote the encoding necessary for files containing JavaScript source code. The alternative MIME type for this file type is text/javascript.
    public const string ApplicationXJavascript = "application/x-javascript";
    
    ///24bit Linear PCM audio at 8-48kHz, 1-N channels; Defined in RFC 3190
    public const string AudioL24 = "audio/L24";
    
    ///Adobe Flash files for example with the extension .swf
    public const string ApplicationXShockwaveFlash = "application/x-shockwave-flash";
    
    ///Arbitrary binary data.[5] Generally speaking this type identifies files that are not associated with a specific application. Contrary to past assumptions by software packages such as Apache this is not a type that should be applied to unknown files. In such a case, a server or application should not indicate a content type, as it may be incorrect, but rather, should omit the type in order to allow the recipient to guess the type.[6]
    public const string ApplicationOctetStream = "application/octet-stream";
    
    ///Atom feeds
    public const string ApplicationAtomXml = "application/atom+xml";
    
    ///Cascading Style Sheets; Defined in RFC 2318
    public const string TextCss = "text/css";
    
    ///commands; subtype resident in Gecko browsers like Firefox 3.5
    public const string TextCmd = "text/cmd";
    
    ///Comma-separated values; Defined in RFC 4180
    public const string TextCsv = "text/csv";
    
    ///deb (file format), a software package format used by the Debian project
    public const string ApplicationXDeb = "application/x-deb";
    
    ///Defined in RFC 1847
    public const string MultipartEncrypted = "multipart/encrypted";
    
    ///Defined in RFC 1847
    public const string MultipartSigned = "multipart/signed";
    
    ///Defined in RFC 2616
    public const string MessageHttp = "message/http";
    
    ///Defined in RFC 4735
    public const string ModelExample = "model/example";
    
    ///device-independent document in DVI format
    public const string ApplicationXDvi = "application/x-dvi";
    
    ///DTD files; Defined by RFC 3023
    public const string ApplicationXmlDtd = "application/xml-dtd";
    
    ///ECMAScript/JavaScript; Defined in RFC 4329 (equivalent to application/ecmascript but with looser processing rules) It is not accepted in IE 8 or earlier - text/javascript is accepted but it is defined as obsolete in RFC 4329. The "type" attribute of the 
    
                                     
                  
提交回复
热议问题