Quick Search for:  in language:    
ASP,POST,PDF,JSP,simple,script,uses,WinHTTP,f
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 203,988. lines
 Jobs: 110. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login


 

 


Latest Code Ticker for ASP/ VbScript.
Click here to see a screenshot of this code!Rapid Classified v2.0
By Gurgen Alaverdian on 1/17

(Screen Shot)

Click here to see a screenshot of this code!Gallery Image with Zoom
By Marcelo Valle Franco on 1/12

(Screen Shot)

Click here to see a screenshot of this code!ASP Photo Competition
By Saul Bryan on 1/12

(Screen Shot)

Execute DTS package
By Himadrish Laha on 1/12


Connecting to a MySQL with ADO, DAO and RDO
By Ahmed Magdy Ezzeldin on 1/11


Automatic Form Insertion To Database
By Yasar Bayar on 1/11


Click here to see a screenshot of this code!Find Closest Physical Location (based on zip code, etc)
By Mark Kahn on 1/11

(Screen Shot)

String --> SQL Search Query
By Mark Kahn on 1/11


Replace text/Numbers for Images...
By Kenneth Nilsson on 1/9


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

ASP Post Forward

Print
Email
 
VB icon
Submitted on: 5/15/2003 2:25:32 PM
By: Andrew Friedl 
Level: Intermediate
User Rating: By 3 Users
Compatibility:ASP (Active Server Pages)

Users have accessed this code 3336 times.
 
(About the author)
 
     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.)
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    '**************************************
    ' for :ASP Post Forward
    '**************************************
    Free as Long as copyright info remains intact.
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' 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
    '
    ' 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 I
    '     P address of the forwarded server.
    '
    ' Side Effects:My not be suitable for po
    '     sting binary data, form posts work fine 
    '     though.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=8368&lngWId;=4    'for details.    '**************************************
    
    <%@ 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
    %>


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
5/16/2003 9:32:09 AM:
Andrew,
5 globes for a clever 
idea!
Kudos to you Bro!
-Blow-
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/16/2003 4:33:16 PM:ICode
Nice!  Great Idea!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/30/2003 10:18:54 PM:
hi,
I guess i need your help .... how 
to use winhttp with asp pages to 
maintain a few connection link with a 
payment gateway server 
(send-and-receive data) with more than 
1 asp page?
Thanks and 
Regards.
ys_foo@unifiedcomms.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/13/2003 4:51:09 AM:FirebirdDE
Using vb-code to convert binary to 
ascii is VERY slow. Try using the ADO 
functions instead or use 
MSXML2.ServerXMLHTTP to download data.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.