Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Web Server to Web Server

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,212
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Web Server to Web Server
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Web Server to Web Server - 6/26/2001 9:49:34 AM   
  mtipton

 

Posts: 1
Score: 0
Joined: 6/26/2001
From:
Status: offline
I need to have my web server format a https request to another server/domain and display the html directly to my client. Any type of redirect or framing where the client actually connects to the other web server and requests the info is a security issue. I need to format and submit the requests from my web server simply proxy the reply into a frame back to the client. I am limited to IIS 4.0 NT 4.0. Any information at all on how to accomplish this would be greatly apreciated, existing scripts/com abjects, examples, anything. Thanks in advance.
 
 
Post #: 1
 
 Re: Web Server to Web Server - 6/27/2001 9:40:43 AM   
  subnation

 

Posts: 20
Score: 0
Joined: 5/22/2001
From: USA
Status: offline
IIS/NT don't have built-in feature for that purpose. To accomplish this , you can use ASP Tear component from SoftWing (free). For more information you can go to http://www.alphasierrapapa.com/IisDev/Components/AspTear/

AspTear

AspTear is a simple component for "tearing" web pages from a server. AspTear allows you to retrieve web pages from servers easily with a bunch of features.

AspTear's main features:

Supports GET and POST
Send query strings and POST data to the server
Access HTTP and HTTPS resources
Log in to secured sites with username/password

Basics

So how does it work? AspTear supports only one method (server-side VBScript pseudocode given here):

Const Request_POST = 1
Const Request_GET = 2
Set xObj = Server.CreateObject("SOFTWING.AspTear")
strRetVal = xObj.Retrieve(strUrl, nRequestType, strQueryString|strPostData, _
strUsername, strPassword)

The file retrieved is returned as method return value (strRetVal; errors are returned with exceptions - see the samples). If you don't need to supply Username and Password, leave them empty (""). Thus, the simplest request looks like this:

strRetVal = xObj.Retrieve("http://www.alphasierrapapa.com/iisdev/",2,"","","")

Notice that we did not supply a document - the component supports redirects! Now let's get a little bit more sophisticated: POST a form to the server with form data. How is this form data formatted? It needs to have the following form,

variable1=value1&variable2=value2...

where value1 to n need to be URL-encoded. To URL-encode a string value, use Server.URLEncode (this is also mandatory for querystrings):

strPostData = "Name=" & Server.URLEncode("Christoph Wille") & _
"&goto=" & Server.URLEncode("http://www.alphasierrapapa.com/")

The call to Retrieve now looks like this:

strRetVal = xObj.Retrieve("http://www.alphasierrapapa.com/",1,strPostData,"","")

The last thing to discuss is how to access SSL-secured items - it is as simple as replacing http:// with https:// in the strUrl parameter!

ASP Sample

In this section, there is a simple sample with two files: formpost.asp (Listing 1) which accepts a parameter and dumps it with the ALL_HTTP server variable; the second file is testretrieve.asp (see Listing 2), which uses the component to retrieve the formpost.asp file and return it to the client.

Listing 1: formpost.asp

 
<%
Response.Write Request.ServerVariables("ALL_HTTP")
%>

<%
Response.Write Request.Form("test")
%>






See it in action - Click Here!

Listing 2: testretrieve.asp

<%
Const Request_POST = 1
Const Request_GET = 2

Set xobj = CreateObject("SOFTWING.ASPtear")
Response.ContentType = "text/html"

On Error Resume Next
' URL, action, payload, username, password
strRetval = xobj.Retrieve("http://devcenter.net-impact.net/formpost.asp", _
Request_POST, "", "", "")

If Err.Number <> 0 Then
Response.Write ""
If Err.Number >= 400 Then
Response.Write "Server returned error: " & Err.Number
Else
Response.Write "Component/WinInet error: " & Err.Description
End If
Response.Write "
"
Response.End
End If

Response.Write strRetval
%>

See it in action - Click Here!

A Practical Example

A more practical example of the uses for ASPTear involve using the Open Directory Project

ASP Tear will allow you to take content from a page but strip out all or some of the images and other branding information. By combining ASP Tear and the Open Directory Project, you can create your own full-functional, search engine. Take a look at how we've used this in our own search engine. All of the data is pulled fresh from the Open Directory Project, but the graphics and look of the page are ours, on our servers.

(in reply to mtipton)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Web Server to Web Server Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts