This article mainly introduces ASP forced refresh of web pages and judging file address instance code. Friends who need it can refer to it
Force refresh of the web page
- <%
- 'Mandatory refresh of random verification code
- 'Let the random verification code be automatically refreshed every time the back button of IE is pressed,
- Response.expires=-1
- Response.AddHeaderpragma,no-cache
- Response.AddHeadercache-control,no-store
- %>
Determine whether the file address is valid
- <%
- Response.Write()
- OnErrorResumeNext
- Dimthisurl, thistext
- thisurl=Request(thisurl)' defines the file address (non-Html format document)!
- ifthisurl=then
- Response.Write (Please enter the file address first!)
- Response.End
- Endif
- Functionobjxmlhttp(xmlurl)
- OnErrorResumeNext
- Setobjxml=CreateObject(Microsoft.XMLHTTP)
- objxml.Openget,xmlurl,false
- objxml.setrequestheadercontent-type,application/x-www-form-urlencoded
- objxml.send
- objxmlhttp=objxml.responsebody
- ifErrthen
- Err.Clear
- Response.Write (Failed to establish the connection, the file does not exist or there is a network problem!; Error reason: &Err.Description&!)
- Response.End
- Endif
- EndFunction
- Functionbytes2BSTR(vIn)
- strReturn=
- Fori=1ToLenB(vIn)
- ThisCharCode=AscB(MidB(vIn,i,1))
- IfThisCharCode<&H80Then
- strReturn=strReturn&Chr(ThisCharCode)
- Else
- NextCharCode=AscB(MidB(vIn,i+1,1))
- strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
- i=i+1
- EndIf
- Next
- bytes2BSTR=strReturn
- EndFunction
- thisurl2=Split(thisurl,,)
- ForEachiiInthisurl2
- thistext=bytes2BSTR(objxmlhttp(ii))
- ifInStr(thistext,)<>0then
- Response.Write(&ii&×
- )
- Else
- Response.Write(&ii&√
- )
- Endif
- Next
- ifErrthen
- Err.Clear
- Response.Write (I encountered an accident!;Error reason:&Err.Description&!)
- Response.End
- Endif
- %>
The above is the code for forced refreshing of web pages and judging file address. I hope it will be helpful to everyone's learning.