ASP
  Home arrow ASP arrow Page 4 - HTTP Tunneling Revealed: Part 1/3
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

HTTP Tunneling Revealed: Part 1/3
By: Adnan Masood
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 16
    2002-10-17

    Table of Contents:
  • HTTP Tunneling Revealed: Part 1/3
  • What is HTTP Tunneling?
  • More on iNET and XMLHTTP
  • ASPTear In Action
  • A ServerXMLHTTP Example
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    HTTP Tunneling Revealed: Part 1/3 - ASPTear In Action


    (Page 4 of 6 )

    This example shows the basic functionality of authentication and handling post requests using ASPTear. Its written by the manufacturer. Source code for the included file asptearinclude.asp can be found here.

    <!-- #include file="asptearinclude.asp" -->
    <html>
    <head>
    <META NAME="generator" CONTENT="Allaire HomeSite 4.0">
    <title>Retrieval of POST page</title>
    </head>
    <body>
    <%
    Dim xObj, strResult, strUrl

    ' create the object
    Set xobj = CreateObject("SOFTWING.ASPtear")

    On Error Resume Next

    ' set a referrer, don't cache pages, supply a custom user agent and a timeout
    xObj.Referrer = "http://www.vatican.va/"
    xObj.ForceReload = True
    xObj.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)"
    xObj.ConnectionTimeout = 45

    strUrl = Request.ServerVariables("SCRIPT_NAME")
    strUrl = Left(strUrl,InStrRev(strUrl,"/")) & "formpost.asp"
    strUrl = "http://" & Request.ServerVariables("SERVER_NAME") & strUrl

    ' URL, action, payload, filename, username, password
    strResult = xobj.Retrieve(strUrl, Request_POST, "test=it", "", "")
    HandleError

    Response.Write "<font color=""red"">" & strResult & "</font>"
    Response.Write "<br><b>Headers:</b><br><PRE>" & xObj.Headers & "</PRE>"
    %>

    </body>
    </html>


    Some of the less known components include Flicks Software's OCXHttp. It's an MFC written COM component with Installshield to avoid the registration hassle. With full support for GET, HEAD and POST requests, it can be used to set accept headers, user agent, content type, accept ranges, status text, cookies - including multiple cookies on one file, etc. They mention that it uses the Inet control, which others have avoided because of the documented problems with WinInet.dll, I never understood why.

    Instantiating and using OCXHTTP is similar and simple as others, but since this article focuses on the evolution of distributed EDI, I think it justifies writing something about every available effort. Similar to others, OCXHTTP has standard GET, POST and HEAD functionality, as well as methods like combineURL, to add relative and base URL formatting into one. It has authentication, and methods like FlagReload / FlagDontCache to handle the caching, session re-use and FlagUseExistingConnect, optimization, custom flags, setting user agent (browser), timeouts and more.

    The MSXML Revolution

    Microsoft XMLHTTP: Released as part of Internet Explorer 5.0 (and later), or IIS 5 (and later) and created lot of change in the development vision. As a default configured HTTP component, it was stated as "superglue for the web". This suite was originally for the XML DOM manipulation, but it included the XMLHTTP object for URI stream handling. This object was developed extensibly enough to send GET/POST/Head requests and retrieve the XML/HTML or binary data as result. It came as the MSXML 3.0 parser.

    Microsoft ServerXMLHTTP: Was actually a replacement for XML HTTP for better performance on busy web servers. It was claimed to make the server more reliable as compared to its precursor.

    Below I demonstrate how XMLHTTP can be used for implementing the HTTP GET method -- in this case Google. The mega search engine, Google, if provided with a search phrase in the query string, returns the search results , i.e. http://www.google.com/search?q=web+services where web services is the search phrase.

    This example is for educational purposes only. For commercial usage, one must read the terms and conditions for affiliate programs provided:

    <%@ Page aspcompat=true %>
    <%
    Dim objXMLHTTP, xml
    ' Create an xmlhttp object:
    xml = Server.CreateObject("Microsoft.XMLHTTP")

    ' Version 3.0 of XMLHTTP, use:
    ' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

    ' Opens the connection to the remote server.
    xml.Open ("GET", "http://www.google.com/search?q=web+services", False)
    ' Actually Sends the request and returns the data:
    xml.Send
    'Display the HTML and Text
    'Response.Write ("<h1>The HTML text</h1><xmp>")
    'Response.Write (xml.responseText)
    'Response.Write ("</xmp>")
    Response.Write ("<h1>This is generated results from google using XMLHTTP </h1>") Response.Write (xml.responseText)
    xml = Nothing
    %>


    XMLHTTP's GET Request Results

    For ServerXMLHTTP, I have an interesting example. BAA Plc provides live flight information for UK airports. If we provide a flight number in the query string, it displays the status of flight i.e. Scheduled time, Coming from, Flight Number, Status and Terminal. In our case it's BA719 from Zurich. The query string seems long, but when I executed it without the airport number, the error result was:

    DTWA000E: Net.Data detected an internal error DTWL018E: Net.Data detected a null value in parameter airport in function DTW_UPPERCASE.

    ... exposing the system modules and those parameter errors that not handled properly. Anyway, the query string with the flight number is shown below:

    http://shop.baa.co.uk/cgi-bin/ncommerce3/ ExecMacro/flights/arrivals.d2w/ report?flightnumber=BA719&comingfrom= &hour=Hour&min=Min&hourselect=0 &minselect=0&airport=LHR&timeframe=&terminalselect=0&terminal=All

    More ASP Articles
    More By Adnan Masood


     

    ASP ARTICLES

    - Central Scoreboard with Flash and ASP
    - Calorie Counter Using WAP and ASP
    - Creating PGP-Encrypted E-Mails Using ASP
    - Be My Guest in ASP
    - Session Replacement in ASP
    - Securing ASP Data Access Credentials Using t...
    - The Not So Ordinary Address Book
    - Adding and Displaying Data Easily via ASP an...
    - Sending Email From a Form in ASP
    - Adding Member Services in ASP
    - Removing Unconfirmed Members
    - Trapping HTTP 500.100 - Internal Server Error
    - So Many Rows, So Little Time! - Case Study
    - XDO: An XML Engine Class for Classic ASP
    - Credit Card Fraud Prevention Using ASP and C...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek