Home arrow ASP arrow Page 4 - The Power of the XMLHTTP Library

The Power of the XMLHTTP Library

XMLHTTP is a set of API's that allows us to send and retrieve data to and from a remote web server using its underlying HTTP protocols and methods. In this article, Mitchell provides us with a basic introduction to the XMLHTTP library, with some examples to get you started.

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 76
December 18, 2001
  1. · The Power of the XMLHTTP Library
  2. · XMLHTTP in a nutshell
  3. · Processing the request on the remote server
  4. · The XMLHTTP document headers
  5. · Conclusion

print this article

The Power of the XMLHTTP Library - The XMLHTTP document headers
(Page 4 of 5 )

Along with your response from the remote server, the XMLHTTP library also returns a number of HTTP headers. These headers can be accessed using the GetAllResponseHeaders method of the XMLHTTP library, as shown below:

Response.Write ObjXMLHTTP.GetAllResponseHeaders

This would cause our XMLHTTP object to send all of its headers directly to the browser. On my Windows 2000 server, the headers looked like this:

Server: Microsoft-IIS/5.0

Date: Tue, 18 Dec 2001 00:06:04 GMT

Connection: keep-alive

Content-Length: 8

Content-Type: text/html

Cache-control: private

These headers can come in handy if you’re trying to debug a problem with the remote servers response to your XMLHTTP request. The Content-Length variable contains the number of characters returned from the request. Keep in mind though, that even if you request a non-existent document, the Content-Length variable will still contain the length of the error message generated by the remote web server.

If we want to get the details of each individual header variable, we can use the GetResponseHeader method. To retrieve the Content-Length, we would use it like this:

Response.Write objXMLHTTP.GetResponseHeader("Content-Length")

Remember that you can also use the Response.AddHeader method to add your own headers to the servers’ response. These could come in handy if you’re trying to debug database connections on the remote server, for example.
blog comments powered by Disqus

- 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...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials