Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:14:44+00:00 2026-05-22T18:14:44+00:00

Can someone help me.I am using the below piece of code for accessing a

  • 0

Can someone help me.I am using the below piece of code for accessing a webpage for which i had access through a browser with some user password authentication.
But when i tried the same i got 403 exception, am i doing this wrong?

import java.io.BufferedReader; 
import java.io.InputStreamReader; 
import java.net.URL; 
import java.net.URLConnection; 
import java.net.PasswordAuthentication;
import java.net.Authenticator;
import java.net.InetAddress;
import java.lang.reflect.Proxy;
import java.lang.System;
import sun.misc.*;
import java.net.HttpURLConnection;

public class summa { 

    //static final String kuser = " "; // your account name
    static final String kpass = " "; // your password for the account

    //static class MyAuthenticator extends Authenticator {
        //public PasswordAuthentication getPasswordAuthentication() {
            // I haven't checked getRequestingScheme() here, since for NTLM
            // and Negotiate, the usrname and password are all the same.
            //System.err.println("Feeding username and password for " + //getRequestingScheme());
            //return (new PasswordAuthentication(kuser, kpass.toCharArray()));
        //}
    //}

    public static void main(String[] args) { 

        try { 
                URL google = new URL("http://www.google.com/"); 
                HttpURLConnection yc =(HttpURLConnection)google.openConnection(); 
                System.setProperty("http.proxyHost","171.160.82.70") ;   
                System.setProperty("http.proxyPort", "80") ;   
                String userPassword = " ";   
                String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());   
                //Authenticator.setDefault(new MyAuthenticator());
                yc.setRequestProperty ("Authorization", "Basic " + encoding);   
                yc.setRequestProperty(userPassword, encoding);   
                yc.addRequestProperty("User-Agent","ie-7 (compatible; MSIE 6.0; Windows NT 5.0)"); 

                BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); 
                String inputLine="s"; 

                inputLine=in.readLine();
                System.out.println(inputLine); 


                in.close(); 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
    } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:14:45+00:00Added an answer on May 22, 2026 at 6:14 pm

    See HTTP 403: Forbidden.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone help me with some PHP please. The original code ~works, but the
Can someone please help me with using Regex with NSPredicate? NSString *regex = @(?:[A-Za-z0-9]);
I'm a newbie to SCons and also using pydev. Can someone help me with
I really appreciate if someone can help me with using how to use shape
Perhaps someone can help me out with this one: I'm using a basic search
I wonder if someone can help: Long story short, I'm using MSSQL2005 to build
I'm almost losing it, i really hope someone can help me out! I'm using
This is a class assignment. I had written some codes which I hope someone
Can someone help me please. I had replies to a similar question but am
Please can someone help me. Basically I am using vb.net. All I am doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.