日期:2014-05-16  浏览次数:20799 次

关于URL的相对路径和绝对路径.知道的请进来.
URL红色部分问题. 如何设置相对路径?知道的请告知一下,万分感谢

Dim time2,time1
time1=timer

Url = "http://www.baidu.com/index2.asp"
Url = "index2.asp"


cacheTime=600   '缓存时间,单位为s秒

'强制生成!
If Request.QueryString("g")<>"" Then Call makecache()

'判断 自动生成!
If application("ourcyindex")<>"" And isDate(application("tqexpire_ourcyindex")) Then '如果缓存的日期存在并且符合时间日期格式
    If CDate(application("tqexpire_ourcyindex"))<Now()  Then makecache() '如果缓存到期时间小于了现在的时间,就是过期了,调用生成缓存过程。
Else
    makecache()'如果缓存日期不存在或者不符合时间日期格式,直接调用生成过程。
End If

time2=timer
'这是我为了去掉我站内的执行时间而进行的替换,你可以不管,直接输出application("ourcyindex")就行了

response.write Replace(application("ourcyindex"),"info@ourcy.com","info@ourcy.com 执行时间 "& FormatNumber((time2-time1)*1000,1) &" 毫秒 缓存过期:"& application("tqexpire_ourcyindex")&"")


'定义生成缓存过程
Sub makecache
    List_PageCode=getHTTPPage(Url)
    application.lock
    application("ourcyindex")=List_PageCode
    application("tqexpire_ourcyindex")=dateadd("s",cacheTime,Now()) 
    application.unlock
End Sub




Function getHTTPPage(url) 
    IF(IsObjInstalled("Microsoft.XMLHTTP") = False)THEN
        Response.Write "<br><br>服务器不支持Microsoft.XMLHTTP组件" 
        Err.Clear
        Response.End
    END IF
    On Error Resume Next
    Dim http 
    SET http=Server.CreateObject("Msxml2.XMLHTTP") 
    Http.open "GET",url,False 
    Http.send() 
    IF(Http.readystate<>4)THEN
        Exit Function 
    END IF 
    getHTTPPage=BytesToBSTR(Http.responseBody,"GB2312")
    SET http=NOTHING
    IF(Err.number<>0)THEN
        Response.Write "<br><br>获取文件内容出错" 
        'Response.End
        Err.Clear
    END IF  
End Function