Question

I am running a local server with xampp. I have some html files on it. I can run the files from my computer browser and from my iphone , my android phone and windows phone.

However when i try the BlackBerry i get the message :

HTTP Error 403: Forbidden . You are not authorized to view this page. Please try loading a different page.

If i press to view Details :

The following error was encountered while trying to retrieve the URL : myServersUrl

Access Denied

Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.

Now i was very careful to connect to the same wifi , as my computer that runs the server is connected , i type the ip correctly as i do to my other phones that i connect with no problem and i have my 3g closed so that i know it will use the wifi. Also i can open any page from the browser, that means i do have internet on the phone. BIS/BES are enabled.

Any idea why i cant connect on my local server here?

Some Code


I try to connect like this :

 BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
        myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
        BrowserField browserField = new BrowserField(myBrowserFieldConfig);

        add(browserField);
        //attaching the udid on the URL
        browserField.requestContent("http://192.123.5.112/Server_CityInfo/jMobile.html?" + udid);

and

public static HttpConnection getHttpConnection(String url, byte[] postData) {
        HttpConnection conn = null;
        OutputStream out = null;
        try {
            conn = (HttpConnection) new ConnectionFactory().getConnection(url).getConnection();
            if (conn != null) {
                if (postData == null) {
                    conn.setRequestMethod(HttpConnection.GET);
                    conn.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
                } else {
                    conn.setRequestMethod(HttpConnection.POST);
                    conn.setRequestProperty("Content-Length", String.valueOf(postData.length));
                    conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                    conn.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");

                    out = conn.openOutputStream();
                    out.write(postData);
                    out.flush();
                }
                if (conn.getResponseCode() != 0) {
                    return conn;
                }
            }
        } catch (Exception e) {
        } finally {
            try {
                out.close();
            } catch (Exception e2) {
            }
        }

        //Only if exception occurs, we close the connection.
        //Otherwise the caller should close the connection himself.
        try {
            conn.close();
        } catch (Exception e1) {
        }
        return null;
    }
Was it helpful?

Solution

It would help if you included the relevant code from the BlackBerry app that sets up the connection. If you're not using the ConnectionFactory, you have to add appenders to make sure the connection is routed to the transport you are expecting. This is why including the code is helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top