ASP Post Forward
This simple ASP script uses WinHTTP to forward an ASP POST to an entirely different server and retun the content to the original ASP page. It is useful for serving up client content from another http source. In my case it is used to serve PDF reports from Java Server Pages to an ASP front end website. With this script you can server the content to the external user while the origin of the content itself appears to be the internet server. (People are unaware of the Apacha Tomcat Server running JSP and wont try to hack into it.)
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
<%@ LANGUAGE = "VBScript" %><%
' Module : ASP POST Forward
' Author : Andrew Friedl
' Copyright: 2003.04.15 - Andrew Friedl
' License : License is hereby granted for commercial and
' non-commercial use as long as the authors
' information and copyright remains intact.
Dim http: Set http=Server.CreateObject("WinHttp.WinHttpRequest.5")
Private Function ConvertBin(bsString)
Dim nIndex
For nIndex = 1 to LenB(bsString)
ConvertBin = ConvertBin & Chr(AscB(MidB(bsString,nIndex,1)))
Next
End Function
http.Open "POST", "http://TargetServer/TargetPage.ASP", False
http.SetTimeouts 60000, 60000, 60000, 60000
http.SetRequestHeader "Content-Type", Request.ServerVariables("CONTENT_TYPE")
http.Send Trim(ConvertBin(Request.BinaryRead( Request.TotalBytes )))
Response.Clear
Response.ContentType = http.GetResponseHeader("content-type")
Response.BinaryWrite http.ResponseBody
Response.End
%>