Name
AcceptTypes
Synopsis
stringArray = Request.AcceptTypes
Return s a String array containing the Multipurpose Internet Mail Extension (MIME) types accepted by the client. You can use this property to determine whether a client can accept certain response types, including application types such as Word or Excel, which are supported only by Internet Explorer.
The following table lists some common MIME types:
MIME type |
Description |
---|---|
text/html |
HTML text content |
text/xml |
XML text content |
image/gif |
GIF-encoded image data |
image/jpg |
JPEG-encoded image data |
application/msword |
Binary data for Microsoft Word |
Parameters
-
stringArray
A String array that receives the array of accept types from the property.
Example
The code example declares a string array and an integer counter variable and assigns the AcceptTypes property value to the array variable. It then iterates the array members using the counter variable, writing each value to the browser by using the Message label control:
Sub Page_Load( ) 'Display Accept Types Dim MyArray( ) As String Dim I As Integer MyArray = Request.AcceptTypes For I = 0 To MyArray.GetUpperBound(0) Message.Text &= "Type " & CStr(I) & ": " & CStr(MyArray(I)) & _ "<br/>" Next I End Sub
The output of the code would look something like this:
Type 0: image/gif |
Type 1: image/x-xbitmap |
Type 2: image/jpeg |
Type 3: image/pjpeg |
Type 4: application/vnd.ms-powerpoint |
Type 5: application/vnd.ms-excel |
Type 6: application/msword |
Type 7: */* |
Notes
This property can prevent the server ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.