How does Basic Authentication work?

Discussion in 'Java' started by dan, Jul 30, 2003.

  1. dan

    dan Guest

    URLConnection connection = url.openConnection();

    connection.setRequestProperty("Proxy-Authorization", "Basic
    "+"c2VydmljZTAxAdswMQ==");

    connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible;
    MSIE 5.5; Windows NT 5.0)");
    connection.setRequestProperty("Accept", "text/html, image/*");
    connection.setDoInput( true );
    connection.setDoOutput( true );
    connection.setUseCaches( false );

    connection.connect();



    So this is my code...
    Proxy-Authorization does work! How can I logon to another site via
    Basic Authentication?
    dan, Jul 30, 2003
    #1
    1. Advertising

  2. dan

    Chris Smith Guest

    dan wrote:
    > URLConnection connection = url.openConnection();
    >
    > connection.setRequestProperty("Proxy-Authorization", "Basic
    > "+"c2VydmljZTAxAdswMQ==");
    >
    > connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible;
    > MSIE 5.5; Windows NT 5.0)");
    > connection.setRequestProperty("Accept", "text/html, image/*");
    > connection.setDoInput( true );
    > connection.setDoOutput( true );
    > connection.setUseCaches( false );
    >
    > connection.connect();
    >
    >
    >
    > So this is my code...
    > Proxy-Authorization does work! How can I logon to another site via
    > Basic Authentication?


    Umm, set an Authorization header, I guess. It looks exactly like your
    Proxy-Authorization header, so you've already got the code to build it,
    right?

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
    Chris Smith, Jul 30, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brett Porter
    Replies:
    2
    Views:
    748
    Andrea D'Onofrio [MSFT]
    Jan 20, 2004
  2. Mark
    Replies:
    0
    Views:
    667
  3. Brett Porter
    Replies:
    5
    Views:
    575
    Brett Porter
    Feb 3, 2004
  4. Dom
    Replies:
    0
    Views:
    449
  5. Dom
    Replies:
    0
    Views:
    486
Loading...

Share This Page