'************************************** ' for :ASP Post Forward '************************************** Free as long as copyright info remains intact. '************************************** ' Name: ASP Post Forward ' Description:This simple ASP script use ' s WinHTTP to forward an ASP POST to an e ' ntirely different server and retun the c ' ontent to the original ASP page. It is u ' seful for serving up client content from ' another http source. In my case it is us ' ed to serve PDF reports from Java Server ' Pages to an ASP front end website. With ' this script you can server the content t ' o the external user while the origin of ' the content itself appears to be the int ' ernet server. (People are unaware of the ' Apacha Tomcat Server running JSP and won ' t try to hack into it.) ' By: Andrew Friedl (from psc cd) ' ' ' Inputs:An HTML form post. ' ' Returns:The exact response from the fo ' rwarded server to the original ASP page. ' ' 'Assumes:You webserver can result the IP ' address of the forwarded server. ' 'Side Effects:My not be suitable for pos ' ting binary data, form posts work fine t ' hough. '************************************** <%@ LANGUAGE = "VBScript" %><% ' Module : ASP POST Forward ' Author : Andrew Friedl ' Copyright: 2003.04.15 - Andrew Friedl ' License : License is hereby granted fo ' r commercial and ' non-commercial use as long as the auth ' ors ' information and copyright remains inta ' ct. 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 %>