PRB: "Entity Too Large" Error Message When You Send Data to a Mobile Device (309462)



The information in this article applies to:

  • Microsoft Mobile Internet Toolkit (MMIT)

This article was previously published under Q309462

SYMPTOMS

Mobile Web Forms controls provide a mechanism for automatically displaying large groups of content in smaller "pages." This functionality is called pagination. When you send large amounts of data to a mobile device, it is recommended that you enable pagination on a form by setting Paginate=true on the mobile:Form tag.

Some devices do not contain enough memory to display large amounts of data, and as a result, you may receive an error message when pagination is not enabled on a mobile Web Form.

Specifically, you may receive the following error message when you use the Nokia WAP Toolkit 2.1:
Http Error - Entity Too Large
And you may receive the following error message when you use the Nokia Mobile Internet Toolkit 3.0:
Requested entity too large
Some devices or emulators may not generate an error message, but instead become slow to respond when you scroll the large list that is returned. Other devices may not be able to function until they are reset.

CAUSE

This behavior can occur if pagination is not enabled.

RESOLUTION

To resolve this issue, enable pagination.

The pagination feature is based on a weighting system. Each control on a mobile Web Form is assigned a unit value. The unit value of all the controls on the page is compared against the OptimumPageWeight property to determine where to divide the page to prevent memory errors. You can configure the OptimumPageWeight property to increase or decrease the weight that a device can support. Configure the OptimumPageWeight property in the section of the Machine.Config file that is used to identify mobile devices.

MORE INFORMATION

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Steps to Reproduce the Problem

The following steps demonstrate this issue by using the Nokia Mobile Internet Toolkit 3.0 and by sending a large list of data to the emulator. These steps presume that Microsoft Visual Studio .NET, Microsoft Mobile Internet Toolkit, and Nokia Mobile Internet Toolkit 3.0 are installed on your computer.
  1. Start Visual Studio .NET, and then create a new C# mobile Web application named "Pagination."
  2. From the Toolbox, drag and drop a single List control to the mobile Web Form that is created by default. Leave the name of the list as "List1."
  3. Right-click the MobileWebForm1.aspx file in the Solution Explorer, and then click View Code.
  4. Add the following code to the Page_Load function:
    for(int x = 1; x < 3000; x++) 
    {
    List1.Items.Add("Item " + x.ToString());
    }
    					
  5. Save and build the project.
  6. View the mobile Web page in a mobile Web browser.

    If the device does not have enough memory, you may receive an error message.
  7. To resolve these types of error messages, you need to add the Paginate attribute to the mobile:form tag in your .aspx page, as follows:
    <mobile:Form id="Form1" runat="server" Paginate="True">
    					
  8. View the page again in the mobile device.

    Note that you no longer receive an error message, and the data is available on multiple pages.

Modification Type:MajorLast Reviewed:6/14/2002
Keywords:kbCHTMLDevice kbDeviceSpecific kberrmsg kbprb kbServerControls kbWebForms kbWMLDevice KB309462