有时候会有这个错误,
403 Forbidden
有时候会也有这个错误,
404 Not Found
/zyproject/Web/WEB-INF/docs/20040826124644000000.jpg was not found on this server
拜托各位给个意见,到底怎么一回事情呀?
403 Forbidden
有时候会也有这个错误,
404 Not Found
/zyproject/Web/WEB-INF/docs/20040826124644000000.jpg was not found on this server
拜托各位给个意见,到底怎么一回事情呀?
<%@ include file="/DataIni/DataOpen.jsp"%>
<%@ include file="/ScriptLib/Init.jsp"%>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<link rel="stylesheet" type="text/css" href="/StyleLib/Default_Style_Sheet.css">
</head>
<body>
<%//@ include file="/TemplateLib/Wsh.jsp"%>
<%@ include file="/TemplateLib/Head.jsp"%>
<center>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td width="100%" valign="top">测试XMLHTTP</td>
</tr>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td width="100%" valign="top">
<input type="text" value="http://10.70.38.10:9002/System/Dot/Show.jsp?Id=1" id="URLID">
<input type="text" value="C:\\DownURL.doc" id="LocalURLID">
<input type="button" value="下载" onclick="DownURL(URLID.value,LocalURLID.value);">
</td>
</tr>
</table>
<br>
<div id=App style="border:1 solid #000000;background-color:#FFFFFF;height:200px;overflow:auto;width:80%;z-index:2" contentEditable></div>
<script>
function OpenFile(strFileName)
{
try
{
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=false;
var Doc=WordApp.Documents.Open(strFileName);
Doc.Activate();
Doc.Parent.Options.InsertedTextColor=4;
Doc.Parent.Options.InsertedTextMark=2;
Doc.Parent.Options.DeletedTextColor=4;
Doc.Parent.Options.DeletedTextMark=1;
Doc.TrackRevisions=true;
Doc.PrintRevisions=true;
Doc.ShowRevisions=true;
Doc.Application.UserName="";
var Range=Doc.Range();
Range.Select();
var Selection=WordApp.Selection;
Selection.Copy();
App.focus();
document.execCommand("Paste");
App.focus();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e)
{
window.confirm(e);
}
}
function DownURL(strRemoteURL,strLocalURL)
{
try
{
var xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");
xmlHTTP.open("Get",strRemoteURL,false);
xmlHTTP.send();
var adodbStream=new ActiveXObject("ADODB.Stream");
adodbStream.Type=1;//1=adTypeBinary
adodbStream.Open();
adodbStream.write(xmlHTTP.responseBody);
adodbStream.SaveToFile(strLocalURL,2);
adodbStream.Close();
adodbStream=null;
xmlHTTP=null;
OpenFile(strLocalURL);
}
catch(e)
{
window.confirm("下载URL出错!");
}
//window.confirm("下载完成.");
}
</script>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td width="100%" valign="top">测试XMLHTTP</td>
</tr>
</table>
</br>
</center>
<%@ include file="/TemplateLib/Tail.jsp"%>
<%@ include file="/DataIni/DataClose.jsp"%>
</body></html>
public void ReadURL(String strURL)
{
try
{
int iHttpResult;
URL m_URL=new URL(strURL);
URLConnection m_URLConn=m_URL.openConnection();
m_URLConn.connect();
HttpURLConnection m_HttpConn=(HttpURLConnection)m_URLConn;
iHttpResult=m_HttpConn.getResponseCode();
if(iHttpResult!=HttpURLConnection.HTTP_OK)
JOptionPane.showMessageDialog(this,"无法连接...");
else
{
int iFileSize=m_URLConn.getContentLength();
InputStreamReader m_Reader=new InputStreamReader(m_URLConn.getInputStream());
char[] Buffer=new char[2048];
int iNum=0;
while(iNum>-1)
{
iNum=m_Reader.read(Buffer);
if(iNum<0)break;
//JOptionPane.showMessageDialog(this,new String(Buffer,0,iNum));
}
m_Reader.close();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
CString CDownInfoDlg::DownURL(CString strURL)
{
CInternetSession m_Session("DigitalTitan");
CHttpFile* pFile=NULL;
CException* e; TCHAR szTempPath[MAX_PATH],szTempFile[MAX_PATH];
DWORD dwResult=::GetTempPath(MAX_PATH,szTempPath);
CString strURLPath;
GetTempFileName(szTempPath,_T("DigitalTitan_"),0,szTempFile);
strURLPath=szTempFile;
TRY
{
pFile=(CHttpFile*)m_Session.OpenURL(strURL);
}
CATCH_ALL(e)
{
pFile=NULL;
AfxMessageBox("URL地址不合法",MB_ICONINFORMATION);
return "";
}
END_CATCH_ALL if(pFile)
{
DWORD dwStatus;
DWORD dwBufLen=sizeof(dwStatus);
BOOL bSuccess=pFile->QueryInfo(HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,&dwStatus,&dwBufLen);
if(bSuccess&&dwStatus>=200&&dwStatus<300)
{
CStdioFile m_File;
if(m_File.Open(strURLPath,CFile::modeWrite|CFile::modeCreate|CFile::typeBinary))
{
BYTE pBuf[1024];
DWORD dwRead;
do
{
dwRead=pFile->Read(pBuf,1024);
m_File.Write(pBuf,dwRead);
}
while(dwRead>0);
m_File.Close();
}
}
pFile->Close();
delete pFile;
}
else
{
m_Session.Close();
}
return strURLPath;
}