Microsoft KB Archive/312099

= PRB: Loss of Query Sting Values When You Use J-PHONE =

Article ID: 312099

Article Last Modified on 6/14/2002

-

APPLIES TO


 * Microsoft Mobile Internet Toolkit 1.0

-



This article was previously published under Q312099



SYMPTOMS
When you use the J-PHONE and the J-PHONE emulator, if you append query string values to the Action attribute of a tag and use the HttpRequest.QueryString collection to retrieve the values, no query string values are retrieved.



CAUSE
This problem occurs because of a J-PHONE limitation wherein you cannot append a query string to the URL in the Action attribute of a tag.



RESOLUTION
When you use the J-PHONE and the J-PHONE emulator, use the HttpRequest collection instead of HttpRequest.QueryString to retrieve query string values from the Action attribute of a tag.



Steps to Reproduce the Behavior
  Create a new .aspx page named Page1.aspx, and then add the following code: <%@ Page Inherits=&quot;System.Web.UI.MobileControls.MobilePage&quot; AutoEventWireup=&quot;true&quot; %> <%@ Register TagPrefix=&quot;mobile&quot; Namespace=&quot;System.Web.UI.MobileControls&quot; Assembly=&quot;System.Web.Mobile&quot; %>

   

Notice the Action attribute contains the code Action=&quot;QueryString2.aspx?name=value&quot;>.   Create a second .aspx page named Page2.aspx, and then add the following code: <%@ Page language=&quot;c#&quot; Inherits=&quot;System.Web.UI.MobileControls.MobilePage&quot; AutoEventWireup=&quot;true&quot; %> <%@ Register TagPrefix=&quot;mobile&quot; Namespace=&quot;System.Web.UI.MobileControls&quot; Assembly=&quot;System.Web.Mobile&quot; %>

   </mobile:Form> void Page_Load(Object sender, EventArgs e) { label1.Text = Request.QueryString[&quot;name&quot;].ToString; } Notice that this code uses Request[&quot;name&quot;].ToString to retrieve the query string value. </li>  Use the code with the J-PHONE and the J-PHONE emulator. Notice that Page2.aspx cannot retrieve the values that are passed from Page1.aspx. Request.QueryString[&quot;name&quot;].ToString does not return any values.

Resolution
</li>  Replace the code in Page2.aspx with the following code: <%@ Page language=&quot;c#&quot; Inherits=&quot;System.Web.UI.MobileControls.MobilePage&quot; AutoEventWireup=&quot;true&quot; %> <%@ Register TagPrefix=&quot;mobile&quot; Namespace=&quot;System.Web.UI.MobileControls&quot; Assembly=&quot;System.Web.Mobile&quot; %>

<body Xmlns:mobile=&quot;http://schemas.microsoft.com/Mobile/WebForm&quot;>  <mobile:Label ID=&quot;label1&quot; Runat=server /> </mobile:Form> void Page_Load(Object sender, EventArgs e) { label1.Text = Request[&quot;name&quot;].ToString; } This code uses the HttpRequest collection instead of the HttpRequest.QueryString collection. </li></ol>

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.

Additional query words: query string empty

Keywords: kbwmldevice kbprb kbemulation KB312099

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.