%@LANGUAGE=VBScript%> <%Option Explicit Response.Buffer = True Response.CacheControl = "Private" Response.Expires = -1 '--- We don't want this to be cached anywhere '---------------------------------------------------------------------------------------- '- ASP PrinterFriendly Application - Version 1.0 - 10 June 2005 '- Copyright © 2005 - Livio Siri (http://www.livio.net) - All Rights Reserved. '---------------------------------------------------------------------------------------- '--- print.asp - Make a link to this page from your page. '--- (ex. Printer friendly) '--- ASSUMES THAT YOUR PAGE HAS PRINTABLE CONTENT WITHIN TWO COMMENTS '--- '--- '--- Needs MSXML 3.0 and VBScript version 5 or above installed '---------------------------------------------------------------------------------------- If Request.ServerVariables("HTTP_REFERER") <> "" Then '--- if this didn't come from anywhere, ignore all. '--- Define variables Dim strContent, xml_http Dim objRegExp, strTitle , strBody, strAns Dim content_start, content_end, title_start, title_end Dim strThisDir '--- Perform the HTTP "GET" method via the XMLHTTP object to retrieve the page to be printed '--- Using the XMLHTTP object instead of something like FSO means that the ASP page '--- is actually executed and not just 'read' as a stream of characters. Set xml_http = Server.CreateObject("Microsoft.XMLHTTP") xml_http.Open "GET", Request.ServerVariables("HTTP_REFERER"), False xml_http.Send strContent = xml_http.responseText Set xml_http = Nothing '--- Get the Referer path for display purpose strThisDir = mid(Request.ServerVariables ("HTTP_REFERER"),1,inStrRev(Request.ServerVariables ("HTTP_REFERER"),"/") ) strBody = strContent '--- strBody contains now the whole HTML page if len(strBody) > 0 Then '--- get the page Title to be printed positioning references title_start = instr(LCase(strBody), "
| Printer Friendly Version of
""><%=Request.ServerVariables("HTTP_REFERER")%>" Page Title: <%=strTitle%> |
|
|
| <%=strbody%> |
|
<%Session.LCID = 1040%>
|