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

  • Home
  • SEARCH
  • 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 4007348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:37:18+00:00 2026-05-20T08:37:18+00:00

Well I enter: Chesslounge.net as the url and I keep getting access denied when

  • 0

Well I enter: Chesslounge.net as the url and I keep getting access denied when I try to get the content what should I do?

Here is some code:

switch(v.getId()) {

            case R.id.button1:

                EditText text = (EditText)findViewById(R.id.editText1);
                TextView tv =(TextView)findViewById(R.id.textView2);
                String data;
                WebFile htmlfile;
            try {
                htmlfile = new WebFile(text.getText().toString());
                data = (String)htmlfile.getContent();

                tv.setText(data);
            } catch (MalformedURLException e) {
                tv.setText("Error: Enter Valid URL");
            } catch (IOException e) {
                tv.setText(e.getMessage());

            }










        }







    }


public final class WebFile {
    // Saved response.
    private java.util.Map<String,java.util.List<String>> responseHeader = null;
    private java.net.URL responseURL = null;
    private int responseCode = -1;
    private String MIMEtype  = null;
    private String charset   = null;
    private Object content   = null;

    /** Open a web file. */
    public WebFile( String urlString )
        throws java.net.MalformedURLException, java.io.IOException {
        // Open a URL connection.
        final java.net.URL url = new java.net.URL( urlString );
        final java.net.URLConnection uconn = url.openConnection( );
        if ( !(uconn instanceof java.net.HttpURLConnection) )
            throw new java.lang.IllegalArgumentException(
                "URL protocol must be HTTP." );
        final java.net.HttpURLConnection conn =
            (java.net.HttpURLConnection)uconn;

        // Set up a request.
        conn.setConnectTimeout( 10000 );    // 10 sec
        conn.setReadTimeout( 10000 );       // 10 sec
        conn.setInstanceFollowRedirects( true );
        conn.setRequestProperty( "User-agent", "spider" );

        // Send the request.
        conn.connect( );

        // Get the response.
        responseHeader    = conn.getHeaderFields( );
        responseCode      = conn.getResponseCode( );
        responseURL       = conn.getURL( );
        final int length  = conn.getContentLength( );
        final String type = conn.getContentType( );
        if ( type != null ) {
            final String[] parts = type.split( ";" );
            MIMEtype = parts[0].trim( );
            for ( int i = 1; i < parts.length && charset == null; i++ ) {
                final String t  = parts[i].trim( );
                final int index = t.toLowerCase( ).indexOf( "charset=" );
                if ( index != -1 )
                    charset = t.substring( index+8 );
            }
        }

        // Get the content.
        final java.io.InputStream stream = conn.getErrorStream( );
        if ( stream != null )
            content = readStream( length, stream );
        else if ( (content = conn.getContent( )) != null &&
            content instanceof java.io.InputStream )
            content = readStream( length, (java.io.InputStream)content );
        conn.disconnect( );
    }

    /** Read stream bytes and transcode. */
    private Object readStream( int length, java.io.InputStream stream )
        throws java.io.IOException {
        final int buflen = Math.max( 1024, Math.max( length, stream.available() ) );
        byte[] buf   = new byte[buflen];;
        byte[] bytes = null;

        for ( int nRead = stream.read(buf); nRead != -1; nRead = stream.read(buf) ) {
            if ( bytes == null ) {
                bytes = buf;
                buf   = new byte[buflen];
                continue;
            }
            final byte[] newBytes = new byte[ bytes.length + nRead ];
            System.arraycopy( bytes, 0, newBytes, 0, bytes.length );
            System.arraycopy( buf, 0, newBytes, bytes.length, nRead );
            bytes = newBytes;
        }

        if ( charset == null )
            return bytes;
        try {
            return new String( bytes, charset );
        }
        catch ( java.io.UnsupportedEncodingException e ) { }
        return bytes;
    }

    /** Get the content. */
    public Object getContent( ) {
        return content;
    }

    /** Get the response code. */
    public int getResponseCode( ) {
        return responseCode;
    }

    /** Get the response header. */
    public java.util.Map<String,java.util.List<String>> getHeaderFields( ) {
        return responseHeader;
    }

    /** Get the URL of the received page. */
    public java.net.URL getURL( ) {
        return responseURL;
    }

    /** Get the MIME type. */
    public String getMIMEType( ) {
        return MIMEtype;
    }
}

}

Here is my logcat where I get the exception:

02-27 08:06:23.622: WARN/System.err(279): java.net.SocketException: Permission denied
02-27 08:06:23.652: WARN/System.err(279):     at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocketImpl(Native Method)
02-27 08:06:23.652: WARN/System.err(279):     at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocket(OSNetworkSystem.java:186)
02-27 08:06:23.662: WARN/System.err(279):     at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:265)
02-27 08:06:23.662: WARN/System.err(279):     at java.net.Socket.checkClosedAndCreate(Socket.java:873)
02-27 08:06:23.662: WARN/System.err(279):     at java.net.Socket.connect(Socket.java:1020)
02-27 08:06:23.672: WARN/System.err(279):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
02-27 08:06:23.672: WARN/System.err(279):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
02-27 08:06:23.672: WARN/System.err(279):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
02-27 08:06:23.682: WARN/System.err(279):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
02-27 08:06:23.682: WARN/System.err(279):     at com.apps.blogspot.blogspot$WebFile.<init>(blogspot.java:110)
02-27 08:06:23.682: WARN/System.err(279):     at com.apps.blogspot.blogspot.onClick(blogspot.java:49)
02-27 08:06:23.692: WARN/System.err(279):     at android.view.View.performClick(View.java:2408)
02-27 08:06:23.692: WARN/System.err(279):     at android.view.View$PerformClick.run(View.java:8816)
02-27 08:06:23.692: WARN/System.err(279):     at android.os.Handler.handleCallback(Handler.java:587)
02-27 08:06:23.702: WARN/System.err(279):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-27 08:06:23.702: WARN/System.err(279):     at android.os.Looper.loop(Looper.java:123)
02-27 08:06:23.702: WARN/System.err(279):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-27 08:06:23.712: WARN/System.err(279):     at java.lang.reflect.Method.invokeNative(Native Method)
02-27 08:06:23.712: WARN/System.err(279):     at java.lang.reflect.Method.invoke(Method.java:521)
02-27 08:06:23.712: WARN/System.err(279):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-27 08:06:23.722: WARN/System.err(279):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-27 08:06:23.722: WARN/System.err(279):     at dalvik.system.NativeStart.main(Native Method)
  • 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-20T08:37:19+00:00Added an answer on May 20, 2026 at 8:37 am

    what should I do?

    My first reaction was that you probably need to make tour application login to the site. But I tried visiting the page using a web browser, and it worked.

    So maybe the “access denied” is some kind of security thing that is local to your android-based application. Can you please show us the stack trace for this error?

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

Sidebar

Related Questions

Well I am trying to submit a form by pressing enter but not displaying
Well, after a long time writing .net programs in C# I started to feel
Well, this is my first post here and really enjoying the site. I have
Well, I'm trying to make ASP.NET urls looking user-friendly, like it was explained in
Well, since I am facing some issues with OAuth implementation, I decided to go
^[a-zA-Z0-9-_. ]*$ for textarea I want to make available the enter as well in
Well i have a little problem but really strange. So basically i analyzed URL
Well I am a new to VB.NET, converting a legacy system to .NET world.
Well, lets see a markup as an example. <div class=_round_5>Some text</div> <div class=_brTop_5>Another Text</div>
Well the subject is the question basically. Are there any version control systems out

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.