¿How can I do this?
Some sites need authentication through an username and password. In
Internet Explorer you can do it with this URL:
http://login:password@server
But it doesn't work with J2ME.
MIDP documentation tells you can do it with HttpConnection class
through the setRequestProperty method, but it's needed to do it before
connect. The one way I know to use an HttpConnection is through these
sentences:
HttpConnection c = null;
c = (HttpConnection)Connector.open(url);
So connection is done inmediately and setRequestProperty cannot be
used.
Some tutorials tell it can be done this way:
HttpConnection c = null;
c = (HttpConnection)Connector.open(url);
c.setRequestProperty("...");
They tell it works because the connection is opened when doing
c.openInputStream(), but it doesn't work, an error occurs telling the
connection is open.
Anyone know the solution?
Best regards
David Aldavero