Microsoft KB Archive/818433

= PRB: Visual J# .NET Application Sends a Second POST =

Article ID: 818433

Article Last Modified on 1/12/2007

-

APPLIES TO


 * Microsoft Visual J# .NET 2003 Standard Edition

-



SYMPTOMS
This problem occurs when you send a POST to an HTTP server in your Visual J# .NET application. After you receive an OK response from the HTTP server, the Visual J# .NET application sends a second POST to the HTTP server that has a content length of zero. You can view the details of the second POST by using a Network Monitor trace. The second POST may result in erroneous data. This behavior also occurs in Visual J++ applications that have been upgraded to Visual J# .NET applications.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior
 Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project. In the New Project dialog box, click Visual J# Projects under Project Types, click Console application under Templates, and then click OK.  Replace the existing code with the following code for Class1.jsl: import java.io.*; import java.net.*; import java.util.*; import System.*;

public class Class1 {   public static void main (String[] args) {       try {           URL url = new URL(&quot;http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=VJ%23&quot;); HttpURLConnection con = (HttpURLConnection)url.openConnection; con.setRequestMethod(&quot;POST&quot;); con.setDoOutput(true); System.out.println(con.getResponseMessage); }        catch (System.Exception ioe) {           ioe.ToString; }       finally {       }       } }  Start Network Monitor. On the Capture menu of Network Monitor, click Start. On the Debug menu of Visual Studio .NET, click Start.</li> On the Capture menu of Network Monitor, click Stop and View.</li> In the Network Monitor captured data, you may notice that the application sends a second POST to the server that has a content length of zero.</li></ol>

<div class="references_section">