Click to visit Hosting Systems


Hosting Systems - Serving your business - for all your windows hosting requirements.
ASP Tear Example

<HTML>
<BODY>

<%Sub CreateHTMLPage(getURL,postFile)
'replace "getSite" variable to the address of your site
'to get the complete URL of the active file you want to run
Dim getPage
getPage = "http://www.yourdomain.com/" & getURL

'replace "postSite" to the physical address of your site
'to make a composite physical address of the "HTML" file
'you want to write to
Dim postPage
postPage = MapPAth & postFile

'variables for "ASPTear" component
Const Request_POST = 1
Const Request_GET = 2

'initiate component "ASPTear.dll"
Dim TearObj
Set TearObj = CreateObject("SOFTWING.ASPTear")
TearObj.Referrer = "http://www.anglingnews.net/"
TearObj.ForceReload = True

'Response.ContentType = "text/html"

'Note on above line: you can actually skip it if your asp file
'that you are calling has a similar declaration in its HEAD part,
'like:
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

' to collect the output of the ASP page as a string
Dim strRetrieval
strRetrieval = TearObj.Retrieve(getPage, Request_GET, "", "", "")

'in case of error getting the page, output error
'this is a direct copy from the documentation of ASPTear
If Err.Number <> 0 Then
Response.Write "<b>"
If Err.Number >= 400 Then
Response.Write "Server returned error: " & Err.Number
Else
Response.Write "Component/WinInet error: " & Err.Description
End If
Response.Write "<b>"
Response.End
End If

Set TearObj = Nothing

'write to file...
Dim objFile, objTStream

Set objFile = Server.CreateObject("Scripting.FileSystemObject")
Set objTStream = objFile.OpenTextFile(postPage, 2, True, 0)
objTStream.Write(strRetrieval)

'Clean up...
Set objTStream = Nothing
Set objFile = Nothing
strRetrieval = ""
getPage = ""
postpage = ""
End Sub

%>

<%
'...do your database updating here
' Response.Flush
Call CreateHTMLPage("asptear.asp","asptear.htm")

%>

<%response.redirect "http://www.yourdomain.co.uk/asptear.asp"%>
</BODY>
</HTML>