I am trying to connect to IIS server and trying to get an ASPX page.
But I always get the error Error in HTTP operation.
I tried a similar code(I had set the user agent) for getting a JSP page on Tomcat,but that seems to work fine.
I have pasted my code below.It always throws an IO exception at c.flush()
Any suggestion would be greatlt appreciated.
HttpConnection c = (HttpConnection) Connector.open("http://localhost:2021/test.aspx");
String rawData = "orders="+"none"+"&cust="+"cus1"+"&mob="+"none";
String type = "application/x-www-form-urlencoded";
c.setRequestProperty( "Content-Type", type );
c.setRequestProperty( "Content-Length", Integer.toString(rawData.length()));
OutputStream os = c.openOutputStream();
os.write( rawData.getBytes() );
if ((i=c.getResponseCode()) == HttpConnection.HTTP_OK)
sb = new StringBuffer();
is = http.openInputStream();
while ((ch = is.read()) != -1)
posted 9 years ago
Is my code faulty?.Does anyone have any suggestions