易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP中使用XMLHTTP或ServerXMLHTTP读取远程数据

照例使用xmlhttp同步方式获取数据,可是由于网络不稳定,经常造成'死锁'状况,既send之后一直不返回服务器结果,也不出错.
被这个问题折磨了好久,最后才查到还有ServerxmlHTTP这个对象,看了介绍才知道它才是天生为了服务器端获取其他网站信息设计的.利用他的超时机制,问题轻松解决:D
参考:
http://support.microsoft.com/kb/290761/zh-cn
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/97884cf6-5fdf-4b1f-8273-73c0e098b8f3.asp
下面付简单封装了ServerxmlHTTP的简单类,共参考:
<%
'使用范例
'读取URL 的HTML
dim myHttp
set myHttp=new xhttp
myHttp.URL="http://www.baidu.com"
Response.Write(myHttp.html)
'保存远程图片到本地
myHttp.URL="http://www.baidu.com/img/logo.gif"
myHttp.saveimage="myfile.gif"
'为防止xhttp卡死的情况,使用超时,错误处理
dim sHtmlcode,iStep
myHttp.URL="http://www.acnow.net"
sHtmlcode=myHttp.html
do while myHttp.xhttpError=""
Response.Error("ERROR: AGAIN!
")
sHtmlcode=myHttp.html
iStep=iStep+1
if iStep>100 then
Response.Write("ERROR:OVER!
")
exit do
end if
loop
Response.Write(sHtmlcode)
set myHttp=nothing
'--------------------------------------------------------------------
Class xhttp
private cset,sUrl,sError
Private Sub Class_Initialize()
'cset="UTF-8"
cset="GB2312"
sError=""
end sub
Private Sub Class_Terminate()
End Sub
Public Property LET URL(theurl)
sUrl=theurl
end property
public property GET BasePath()
BasePath=mid(sUrl,1,InStrRev(sUrl,"/")-1)
end property
public property GET FileName()
FileName=mid(sUrl,InStrRev(sUrl,"/")+1)
end property
public property GET Html()
Html=BytesToBstr(getBody(sUrl))
end property
public property GET xhttpError()
xhttpError=sError
end property
private Function BytesToBstr(body)
on error resume next
'Cset:GB2312 UTF-8
dim objstream
set objstream = Server.CreateObject("adodb.stream")
with objstream
.Type = 1 '
.Mode = 3 '
.Open    
.Write body  '
.Position =


相关文档:

asp读取文本内容

'**************************************************    
'函数名:FSOFileRead    
'作 用:使用FSO读取文件内容的函数    
'参 数:filename ----文件名称    
'返回值:文件内容    
'************** ......

vb和asp如何用remote访问远程数据库

访问远程数据库的情况有以下几种:
1)访问远程数据库的access数据库
2)访问远程mssql数据库或oracle等其他关系数据库,但是数据库通信端口被防火墙阻挡或其他网络原因造成无法使用该端口
本文仅在windows2000 advance server,mdac2.8下测试通过,其余条件不保证能正常运行
在mdac的Service Providers中包括Microsoft ......

ASP中Dictionary对象的一个奇怪问题

首先贴代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim objDic
Dim arr(2)
arr(0) = 0
arr(1) = 1
arr(2) = 2
Set objDic = Server.CreateObject("Scripting.Dictionary")
objDic.Add "key",arr
Response.Write("这是修改之前的值:" & objDic.Item("key")(0))
objDic.Item("key")(1) = ob ......

asp 图片循环滚动(left)

<div class="scrollImgList1" id="scrollImgList1">
 <div class="LeftBotton" onmousedown="ISL_GoUp_1()" onmouseup="ISL_StopUp_1()" onmouseout="ISL_StopUp_1()"></div>
 <div class="Cont" id="ISL_Cont_1">
  <div class="ScrCont">
   <d ......

asp数组随机排序

这段代码的功能是:将一个数组打乱顺序,显示出来,让每一次显示的顺序都不一样。
<%
Dim tt
tt=Split("1,2,3,4,5,6",",")
'随机排序  
leng=UBound(tt)
randomize  
for ii=0 to leng-1  
 b=int(rnd()*leng)  
 temp=tt(b)  
 tt(b ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号