This documentation is archived and is not being maintained.

Image.ImageUrl Property

Gets or sets the URL of the image source for the Image control. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the Web site.

Namespace:  System.Web.UI.MobileControls
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

public string ImageUrl { get; set; }
<asp:Image ImageUrl="String" />

Property Value

Type: System.String
The URL of the image source for the Image

Because various devices provide a set of built-in pictures, such as images for a heart, sunshine, a book, a right arrow, and so on, by using a <DeviceSpecific> control within the Image control, you can provide a wide variety of graphics that can be integrated into the devices themselves, as well as standard Web graphics.

For example, you can specify symbol:63726 as the ImageUrl property value for all devices that require WML markup, and Sunshine.gif as the ImageUrl property value for HTML devices.

The exact resolution of the ImageUrl value is provided by an image adapter (such as ChtmlImageAdapter, WmlImageAdapter, or XhtmlImageAdapter).

The following code example shows how to use a <DeviceSpecific> control within an Image control to specify different images for different devices. If a file named Sunshine.gif is available, it will appear in Internet Explorer. If you view the page on a WML device such as an OpenWave phone or a CHTML device, it will appear as a sun icon. The page also displays the name of the browser and the resolved name of the image.


The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Code Model.

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
        string spec1 = "Device: {0}";
        string spec2 = "Image source: {0}";

        if (!IsPostBack)
            Label1.Text = String.Format(spec1,  Device.Browser);
            Label2.Text = string.Format(spec2, Image1.ImageUrl);

<html xmlns="" >
    <mobile:form id="form1" runat="server">
        <mobile:Image ID="Image1" Runat="server" 

            <DeviceSpecific ID="imgDevSec" Runat="server">
                <Choice Filter="isWML11" 
                        ImageUrl="symbol:44" />
                <Choice Filter="isCHTML10" 
                        ImageUrl="symbol:63726" />
                <Choice ImageUrl="sunshine.gif" />

        <mobile:Label ID="Label1" Runat="server" />
        <mobile:Label ID="Label2" Runat="server" />

The following is the <deviceFilters> section of the Web.config file.

  <filter name="isWML11" compare="PreferredRenderingType" argument="wml11" />
  <filter name="isCHTML10" compare="PreferredRenderingType" argument="chtml10" />

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.