Click or drag to resize

MimeType Class

IT Hit WebDAV Classes Reference
Provides functionality for getting mime type by file extension.
Inheritance Hierarchy
SystemObject
  ITHit.WebDAV.ServerMimeType

Namespace:  ITHit.WebDAV.Server
Assembly:  ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 13.3.13068
Syntax
public static class MimeType

The MimeType type exposes the following members.

Methods
  NameDescription
Public methodStatic memberCode exampleExtendTypesTable
Extends the list of content types or replaces existing value with a new one.
Public methodStatic memberGetMimeType
Returns the mime type corresponding to file extension.
Top
Remarks

The GetMimeType(String) static method of this class returns mime type by provided file extension. The class is usually utilized in ContentType implementation. The mime-type is returned in a Content-Type header with GET request. The set of values can be extended with using ExtendTypesTable(String, String) method.

When deciding which action to perform when downloading a file some WebDAV clients and browsers (such as Internet Explorer) rely on file extension, while others (such as Firefox) rely on Content-Type header returned by server. For identical behavior in all browsers and WebDAV clients your server must return a correct mime-type with a requested file.

Examples

The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.

public string ContentType
{
    get { return MimeType.GetMimeType(fileSystemInfo.Extension) ?? "application/octet-stream"; }
}
See Also