我正在使用 xampp 运行本地服务器。我有一些 html 文件。我可以从我的电脑浏览器和我的 iphone、我的 android 手机和 windows 手机运行这些文件。
但是,当我尝试使用 BlackBerry 时,我收到消息:
HTTP Error 403: Forbidden . You are not authorized to view this page. Please try loading a different page.
如果我按查看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.
现在我非常小心地连接到同一个wifi,因为我的运行服务器的计算机已连接,我正确输入了ip,就像我连接的其他手机没有问题一样,我关闭了我的3g,所以我知道它将使用wifi。我也可以从浏览器打开任何页面,这意味着我的手机上有互联网。BIS/BES 已启用。
知道为什么我无法在我的本地服务器上连接吗?
一些代码
我尝试像这样连接:
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);
和
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;
}