PRB: Visual J# .NET Application Sends a Second POST (818433)



The information in this article applies to:

  • Microsoft Visual J# .NET 2002

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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. In the New Project dialog box, click Visual J# Projects under Project Types, click Console application under Templates, and then click OK.
  4. 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("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=VJ%23");
    			HttpURLConnection con = (HttpURLConnection)url.openConnection();
    			con.setRequestMethod("POST");
    			con.setDoOutput(true);
    			System.out.println(con.getResponseMessage());		
    		} 
    		catch (System.Exception ioe) 
    		{
    			ioe.ToString();
    		}
    		finally
    		{
    			
    		}	
    	}
    }
  5. Start Network Monitor.
  6. On the Capture menu of Network Monitor, click Start.
  7. On the Debug menu of Visual Studio .NET, click Start.
  8. On the Capture menu of Network Monitor, click Stop and View.
  9. 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.

REFERENCES

For more information about Network Monitor, visit the following Microsoft Web site:

Modification Type:MinorLast Reviewed:8/15/2005
Keywords:kbWebServer kbJava kbhttp kbprb KB818433 kbAudDeveloper