Content-disposition is an extension of the mime protocol. Some browsers may not support content-Disposition because security considerations are not standardized, such as ie4.01.
You can set the HTTP header to implement some functions.
1. Set the value to attachment to ensure that the "File Download" dialog box is displayed when the client accesses it. (Some mime-type files (for example, *. gif; *. txt; *. htm) are displayed in IE by default. A dialog box cannot be displayed)
2. If the filename attribute is not set in the header, the file name can be specified during client download.
3. Set the value to inline so that the file is displayed in the browser instead of the file download dialog box.
CodeExample:
Response. setheader ("content-disposition", "attachment; filename =" + filename ).
// Content-disposition is the attribute name.
// Attachment indicates downloading as an attachment. If you want to open it on the page, change it to inline.
// Filename specifies the downloaded file name. If this parameter is not specified, the file is determined by the client.
// If it is a Chinese character, garbled characters will appear. There are two solutions:
// 1. Use the filename = new string (filename. getbytes (), "ISO8859-1") Statement
// 2. Use the filename = httputility. urlencode (filename, system. Text. encoding. utf8) Statement
In C #, The system. Web. Mime space provides a large number of mime enumeration types, including in the system. Web. Mail. dll file.
Dispositiontypenames enumerated dispositiontype, (Attachment/inline)