473,666 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add username and password to an HTTP connection with J2ME

¿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 setRequestPrope rty 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 setRequestPrope rty cannot be
used.

Some tutorials tell it can be done this way:

HttpConnection c = null;
c = (HttpConnection )Connector.open (url);
c.setRequestPro perty("...");

They tell it works because the connection is opened when doing
c.openInputStre am(), but it doesn't work, an error occurs telling the
connection is open.

Anyone know the solution?
Best regards
David Aldavero
Jul 17 '05 #1
1 8155
dan
use Java 1.2's Authenticator class.
more info at http://www.javaworld.com/javaworld/j...javatip46.html

-Dan
da**@quigo.com
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1767
by: Rickard | last post by:
OK. I have the need on a form submit to pass the data to anther system that require a login and password only I want to automate the process in an server side asp file and then process the response. I am having the form submit pass a users ss # and name to an asp file, I want that asp file to pass that info on to my "verifying" site along with the username and password for that "verification" site. Is there some way in asp to access a...
3
7126
by: Oren | last post by:
Hi, Is there a way to hide the connection information of linked SQL Server tables from users? It's easy to open a system table and find the connection info, and if the username and password are saved with this info, anyone could potentially access this information. Much thanks, Oren
8
3629
by: Noel Volin | last post by:
Anyone who can help here is much appreciated. I am trying to programmatically log onto a website. I am using the code provided in VS for the AuthenticationManager Class example ( ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm ). I have also download and tried to use the following CsharpHttp executable in an attempt to find my problem:...
15
9724
by: Eugene Anthony | last post by:
Is this method of validation for password and username considered to be secured. In my previous post I was given a solution that uses command object and the values are parsed by parameters. But the solution only worked well for insert and delete, but not select. <% if Request.QueryString("Action") = 1 then username = Trim(request.form("username")) password = Trim(request.form("password")) if username <> "" and password <> "" then
11
13960
by: Kevin O'Brien | last post by:
Hello, I am creating a sign on screen for my application in which I want to store the username and password in a database table. I was thinking of putting a combo box connected to the database to pull up the usernames and then having a textbox for the user to enter their password. Can someone tell me please how to compare the contents of the textbox to the password in the database?
5
3771
by: libra786 | last post by:
I have created a blog and have added a login box which prompts the user for login and id before posting- The username and password have been stored in the database, however when i enter the username and pasword it does not seem to compare the values entered with anything. It jus keeps giving the prompt box to enter details. But if i click cancel, then it tels me the incorrect credentials ave been entered i have tried many ways to solve this...
3
10249
by: %NAME% | last post by:
When using embedded SQL for db2 under solaris, you do not need to give username and password since the system will use your unix-login as default credential. However, with JDBC seems I always need to provide username and password, the Java API DriverManger.getConnection(String url) does not work. I am not sure if this is because the JDBC driver, or because it does not work for DB2 under solaris. Any comments? Thanks a lot!
2
5960
by: %NAME% | last post by:
(Thanks to Bernd, Ian, Phil last time for their detailed answers last time) Now I try to call JDBC driver without giving the username and password as they suggested. I am using DB2 jdbc on SunOS 5.8 with db2 version 7.2.0. When I am using the type2 network driver (COM.ibm.db2.jdbc.net.DB2Driver) with username and password, everything is fine. However, when I use the application driver: (COM.ibm.db2.jdbc.app.DB2Driver), and call...
4
2023
nathj
by: nathj | last post by:
Hi, I'm working on a registration form and one of the checks I need to perform as the form is used is on the username. I need to ensure that it is not already in use. I am getting a little stuck. Here's the code involved (sorry there's quite a bit) and then I'll explain the problem. HTML (relevant sample) <div class="row"> <span class="label" id="usernamelabel"> <span class="warninglabel">Username:</span> </span>
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.