Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
PreferredImageMime Property
Collapse the table of content
Expand the table of content

PreferredImageMime Property

.NET Framework 1.1

Returns the MIME type of the type of image content preferred by the device. The default value is image/gif.

public virtual string PreferredImageMime {
   get
}

Example

The following example demonstrates how to use the PreferredImageMime property to specify the type of preferred image for the device.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
     Dim currentCapabilities As System.Web.Mobile.MobileCapabilities = CType(Request.Browser, System.Web.Mobile.MobileCapabilities)
     Dim prefImage As String = currentCapabilities.PreferredImageMime
     
     If (prefImage.Equals("image/gif"))
        'Set the path of an image to the color image.
        Image1.ImageUrl = "Image.gif"
     Else If (prefImage.Equals("image/vnd.wap.wbmp"))
        'Set the path of the image to a .wbmp image.
         Image1.ImageUrl = "Image.wbmp"
        
     End If
   
End Sub

[C#]

public void Page_Load(Object sender, EventArgs e)
{
   MobileCapabilities currentCapabilities
      = (MobileCapabilities)Request.Browser;
   String prefImage = currentCapabilities.PreferredImageMime;

   if (prefImage.Equals("image/gif"))
   {
      // Set the path of an image to the color image.
      Image1.ImageUrl = "image.gif";
   }
   else if
     (prefImage.Equals("image/vnd.wap.wbmp"))
   {
      // Set the path of the image to a .wbmp image.
      Image1.ImageUrl = "image.wbmp";
   }
}

See Also

Applies to: MobileCapabilities Class

Show:
© 2015 Microsoft