How to pass user name and password in openConnection method ?

Hi, Exports,
          I am trying to post data from applet to another application which is
          protected by network password.
          How to pass user name and password when I use openConnection method? In java
          doc, this method looks like do not accept these two parameters.
          Thanks
          ----- my code in applet ---------
          URL url = new URL("http://127.0.0.1/xml/index.cfm");
          URLConnection connection = url.openConnection();
          connection.setDoInput(true);
          connection.setDoOutput(true);
          connection.setUseCaches(false);
          connection.setAllowUserInteraction(false);
          DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
          dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
          dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
          dos.writeBytes("Content-Type:
          multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
          dos.writeBytes("Host: "+host+":"+port+"\r\n");
          dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
          dos.writeBytes("Connection: Keep-Alive\r\n\n");
          dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
          on: form-data;name=\"xmlDoc\"\r\n\r\n");
          dos.writeBytes(buff.toString());
          dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
          dos.close();
          

you need to negotiate Authentication in ur applet code...
          For example:
          If u r using Form based auth u need to send Post a request with j_user_name &
          j_password to the action j_security_check. and when server returns back the
          cookie
          u need to hold it and pass that cookie to the each and every request made to the
          protected application.
          Basically u need to imitate the browser.
          regards
          aseem
          David wrote:
          > Hi, Exports,
          >
          > I am trying to post data from applet to another application which is
          > protected by network password.
          > How to pass user name and password when I use openConnection method? In java
          > doc, this method looks like do not accept these two parameters.
          >
          > Thanks
          >
          > ----- my code in applet ---------
          > URL url = new URL("http://127.0.0.1/xml/index.cfm");
          > URLConnection connection = url.openConnection();
          > connection.setDoInput(true);
          > connection.setDoOutput(true);
          > connection.setUseCaches(false);
          > connection.setAllowUserInteraction(false);
          > DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
          > dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
          > dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
          > dos.writeBytes("Content-Type:
          > multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
          > dos.writeBytes("Host: "+host+":"+port+"\r\n");
          > dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
          > dos.writeBytes("Connection: Keep-Alive\r\n\n");
          > dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
          > on: form-data;name=\"xmlDoc\"\r\n\r\n");
          > dos.writeBytes(buff.toString());
          > dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
          > dos.close();
          >
          > ------------------------------------------
          

Similar Messages

  • How to validate user name and password in webdynpro.

    Dear All,
    Actually i have created login name and password in view, webdynpro and want to validate the user name and password but  i am not finding proper code to  how to validate user name and password.
    Pl do the needful help.
    Regards.
    Tazeer.
    Moderator Message: There is a seperate forum for WebDynpro. Please ask your question there.
    Edited by: kishan P on Oct 5, 2010 1:08 PM

    Hello, I don´t get you question. User authentication is ready out of the box in webdypro...
    Regards Otto

  • How to suffix user name and password remote pc in shutdown /s command

    Hi,
    We can shutdown a remote pc  using " shutdown /s /m \\ipaddress " command, only if password of remote pc is stored in windows credential  manager.
    But how to  add user name and password when i execute the command for example : when we map a share folder on our pc we use below command with  user name and password
    "net use * \\ipaddress\share password /user:username "
    can we give user name and password of remote pc  while we give shutdown command to turn off  a remote pc (without adding user name and password to windows credentials).
    Thanks in advance..........

    Hello Jayanth kundar,
    Based on my test, I can use the command shutdown /s /m \\10.157.21.77 to shutdown the remote computer when the have the same username and password.
    Do you mean that you want to add user name and password when you want to shutdown the remote computer?
    I can't find a user name and password in Windows Credential Manager, please share us a screenshot.
    Best regards,
    Fangzhou CHEN
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to Assign User name and password to the login screen on button click without user type...

    Hi,
    My requirement is as follows,
    I have three inputs which is User name, Password and URL. URL may be like anything like for example gmail,yahoo,hotmail like that.
    No need to authenticate the URL. Just i want to place the credentials in User ID and Password controls.
    On button click the URL should open in browser and the credentials should place in the controls in log in page.
    How to achieve it. Ultimate thought is the user should know the "Password",only admin know the password.
    Thanks & Regards
    Poomani Sankaran

    Hello,
    If URL's are internal (not third party) then you can do this by modifying both applications. If you are trying to do this with third party then you have to contact product owner. I don't think there is any code or solution for third party application where
    you can set values of controls.
    For internal URL's you can create custom web service and call this web service in both the applications. One to get value from first app and then second to set value in another app.
    Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to pass login name and password

    Hi all,
    If this question has been asked before, please let me know, and I am sorry for duplicate the question raising.
    I want to use the login name and password which are entered from the left frame(topic frame) in the right frame ( the content frame).
    I have 3 jsp programs, "A.jsp" is for validate the login (name and password), "B.jsp" contains a form-submit to add the records to a database. "C.jsp" is the actual one which does the updating to the database.
    Q1, how can I re-use the login name and password for "B.jsp" and "C.jsp"?
    Q2, is there any security problem to do so?
    your useful reply will give me a great help.
    ths

    or try here:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=308840
    http://forum.java.sun.com/thread.jsp?forum=31&thread=295349

  • How to save user name and password on client tool

    Hi,
       In our landscape, few users are using webi rich client tool to work offline. They are entering login credentials manually everytime. Is there any way to save the user id and password, so that user can login without manually entering the login credentials everytime. Please find below my system details. Please anyone help is highly appreciated.
    System Details:
    Server: BOBI 4.1 SP2
    Client tool : BOBI 4.1 SP2
    Authentication type : Windows AD
    Thanking you in anticipation
    Obinna.

    Hello,
    oh yes it is!
    The Question is for which Front- Ends?
    For the WRC you dont have to do anything as long as the Information under "System" is correct and "Windows AD" is selected under "Authentication. Leave "Username" and "Password" blank.
    Just hit "OK" and you are logged in.
    Regards
    -Seb.

  • How to put user name and password

    sir,
    how to put username and password for clsco wap4410n

    Refer the link : http://www.cisco.com/c/dam/en/us/td/docs/wireless/access_point/csbap/wap4410n/quick_start/guide/WAP4410N_QuickStartv2.pdf

  • How to get User Name and password to hyperion download center?

    Do only users who buy hyperion products have to right to access the website?

    Yes - you have to have purchased a product in order to download patches or new versions. Also, you have to pay maintenace in order to have access to new versions.This is not unusual for most software companies - some companies allow you to download a time-expiry trial of their software, but others required you to got through their sales channels in order to get an evaluation copy. Hyperion uses the latter approach.Regards,Jade-----------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

  • How do I connect to Net Flix? I put in my user name and password which work fine with my iMac but not on my Apple TV?

    How do I connect to Net Flix? I put in my user name and password which work fine with my iMac but not on my Apple TV?

    Can you give me a screenshot of the User Accounts window in Control Panel?
    Please create a screenshot by following the guide mentioned at [[How do I create a screenshot of my problem?]].
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. You really help us to visualize the problem.

  • Firefox will not save my user name and password for one of my sites. How can I fix this problem. It is getting annoying having to reenter every time I check this site. Is there a solution.

    I had my user name and password saved for my library site. My grandson hit something and now the saved user name and password are gone. It asks me every time to enter it and it is getting annoying. How do I fix this. I want Firefox to remember these codes.

    You can create a bookmark with the JavaScript code via a right-click on the "Remember Password" link on the squarefree.com website and choose "Bookmark This Link" and select the "Bookmarks Toolbar" as the destination folder for easy access.
    * https://www.squarefree.com/bookmarklets/forms.html#remember_password
    You need to use the "Remember Password" bookmarklet before or after filling the name and password field on the website with the <u>login form</u>, but before submitting the login form by clicking a button on the web page.
    If the site is using autocomplete="off" then you see a number not equal to 0 (i.e. attributes were removed) in the pop-up alert from the bookmarklet and Firefox should offer to remember the name and password via a drop down dialog of the key icon that will appear on the location bar (Firefox 4+) or via an info bar at the top (Firefox 3).

  • HT204053 I did not know my kids had set up an Itunes account for me with one user name and password.  then i got an i phone and set it up with a different email address and new password.  how can i get my accounts to merge so i can have all of my music on

    I did not know my kids had set up an Itunes account for me with one user name and password.  then i got an i phone and set it up with a different email address and new password.  how can i get my accounts to merge so i can have all of my music on my iphone

    Quote: "You cannot merge two or more Apple IDs into a single one. You can, however, use one Apple ID for iCloud services and another Apple ID for store purchases (including iTunes in the Cloud and iTunes Match). See “Using one Apple ID for iCloud and a different Apple ID for Store Purchases” above for details." See also Apple ID & iCloud FAQ: http://support.apple.com/kb/HT4895?viewlocale=en_US&locale=en_US
    You can set up your iCloud account on your iOS device under: "Settings > iCloud" and a other account for store purchases under "Settings > iTunes & App Stores". Unfortunately merging accounts is not possible but you could transfer all of your music manually via iTunes from your Mac or PC.

  • HT1386 How do I create one Apple ID and iTunes user name and password for all of my Apple products: iPad, iPhone, and iPod plus iTunes on my PC?

    How do I create one Apple ID and iTunes user name and password for all of my Apple products: iPad, iPhone, and iPod plus iTunes on my PC?

    Yes, I do have multiple devices and it appeared to me that every time I tried to sync or log onto iTunes, the password was incorrect.  Consequently, I was and am constantly changing it.  Wouldn't it be nice if Apple would simply say that you only need one Apple ID and one password regardless of the number of Apple devices you intend to sync via iTunes. 
    Barring the above, how about a way to merge all of the Apple IDs and passwords into one.

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How can I hide the user name and password from the url address?

    Good afternoon every body,
    I have a form running with Oracle9i Developer Suite Release 2 and when I run the form on the web it shows the user name and password of my data base. Can anyone of you please help me to hide the user name and password, if there's any way of course?.
    Thanks a lot!!.

    Luis,
    Then, as inolau's notice, create logon screen (or use the default one) and force the users to logon at runtime. Do not pass username/password as parameters.
    inolau,
    True that if the connection is specified in the config it will be the same for everyone. However, every case is different. For example one of our apps gets S3 credentials (from non-Oracle S3) as session parameters. It uses this common db connection to validate some stuff with the database, read security definitions and then it re-connects the forms using the credentials.

  • Trying to update my apps on the iPhone 3.  When I type in user name and password, I get the message "Cannot connect to iTunes Store"  How can I connect?

    Trying to update my apps on the iPhone 3.  When I type in user name and password, I get the message "Cannot connect to iTunes Store"  How can I connect?

    I have the same problem. Any suggestions?

Maybe you are looking for

  • How does one print just one page of a long PDF file?

    My mac wants to print all of the pages. Don't see a way to print just one page. Since the pages are numbered 6-19 and so on, I can't enter the specific page numbers to be printed.

  • How to manage Photos for business

    Hi there I have this wonderful IPAD thanks to Apple so I had a crucial question as the main use of my IPAD is for business. I load photos in Iphoto the traditional way, these photos are from my business and required to show clients, the product name

  • Delegate in as3

    This probably is trivial but I am not sure what the problem is. I am trying to call an event listener for a button. The problem is I have many buttons each with a string variable attached to them so that the click function can go to the frame name th

  • Problem about printer

    sir,      my printer is hp printer .In which i got a problem of ''E'' THIS sign is stand for error for ink or paper jam .BUT there is no problem of ink an paper jam in that . when i replace the old cartrage with new one then the error sign gone out .

  • W520 missing Bluetooth. Msinfo32 values... how to resurrect?

    I realized Bluetooth is missing from my w520 (4276). I did some searching: an old thread suggested searching in msinfo32, and I did find the adapter which says it's "installed". There is no PnP ID. There is a "Last reset" noted as of today. Index=9.