最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp讀取遠程文件并保存到本地代碼

 更新時間:2007年03月31日 00:00:00   作者:  
<%
dim act,ifLogin,loginUrl,loginActUrl,loginData,fileUrl,fileName
act=request.QueryString("act")
if(act="do") then 
 ifLogin=Cint(request.QueryString("ifLogin"))
 loginActUrl=request.Form("loginActUrl")
 loginData=request.Form("loginData")
 fileUrl=request.Form("fileUrl")
 fileName=mid(fileUrl,instrrev(fileUrl,"/")+1)
 extPos=instrrev(fileName,"?")
 if(extPos>0) then
  fileName=left(fileName,extPos-1)
 end if
 if(ifLogin=1) then
  call PostHttpPage(loginActUrl,loginData)
 end if
 call DownloadFile(fileUrl,fileName)
else
%>
<form name="form1" method="post" action="?act=do">
  <p>是否登錄:
    <input name="ifLogin" type="radio" value="1">
    是
    <input name="ifLogin" type="radio" value="0" checked>
    否  </p>
  <p>登錄提交地址:
    <input name="loginActUrl" type="text" size="50">
  </p>
  <p>
    登錄數據:<input name="loginData" type="text" size="50">
  </p>
  <p>
    要保存的遠程文件URL:
    <input name="fileUrl" type="text" size="50">
  </p>
  <p>
    <input type="submit" name="Submit" value="提交">
    <input type="reset" name="Submit2" value="重寫">
  </p>
</form>
<%
end if
Function BytesToBstr(body,code) 
        dim objstream 
        set objstream = Server.CreateObject("adodb.stream") 
        objstream.Type = 1 
        objstream.Mode =3 
        objstream.Open 
        objstream.Write body 
        objstream.Position = 0 
        objstream.Type = 2 
        objstream.Charset =code
        BytesToBstr = objstream.ReadText  
        objstream.Close 
        set objstream = nothing 
End Function 
Function PostHttpPage(loginActUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Microsoft.XMLHTTP")  
    xmlHttp.Open "POST", loginActUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"   
    xmlHttp.Send PostData 
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
  response.Write("提交登錄時出錯!提交數據:"&PostData)
        Exit Function
    End If
    PostHttpPage=BytesToBstr(xmlHttp.responseBody,"GB2312")
    Set xmlHttp = nothing
End Function
'''''''''''''''''''''''''''''''''''''''''''
function DownloadFile(url,filename)
 Set xml = Server.CreateObject("Msxml2.XMLHTTP") '創(chuàng)建對象

   xml.Open "GET",url,False
   xml.Send '發(fā)送請求    

   if Err.Number>0 then 
  Response.Status="404"
  else
  Response.ContentType="application/octet-stream"
  Response.AddHeader "Content-Disposition:","attachment; filename=" & filename
  Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
  if Range="" then
   Response.BinaryWrite(xml.responseBody)
  else
   S.position=Clng(Split(Range,"-")(0))
   Response.BinaryWrite(xml.responseBody)
  End if
  end if
 Response.End  
   Set xml = Nothing
end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''
%>

相關文章

最新評論

武陟县| 隆尧县| 广河县| 饶河县| 黄山市| 垦利县| 红安县| 泗阳县| 沈丘县| 简阳市| 武安市| 尼木县| 漯河市| 宜良县| 德保县| 寿阳县| 息烽县| 台江县| 恩施市| 呼和浩特市| 漯河市| 贞丰县| 宁南县| 和龙市| 清水县| 遂溪县| 安康市| 盘山县| 万源市| 辛集市| 奈曼旗| 蚌埠市| 安阳县| 花垣县| 永德县| 皋兰县| 竹溪县| 德化县| 山东省| 松阳县| 南陵县|