Home Page - www.tele-pro.co.uk - Ecommerce Integration


Scripts > HTTP Session Request

HTTP Session Request

This VBScript function can be used to maintain the HTTP session state when retrieving webpages with XMLHTTP. The Cookies and Referrer are stored, and subsequent HTTP requests are re-constructed using these HTTP headers.

For example, if the first HTTP request performs a login at a website, then the second HTTP request will be performed using the same HTTP session, which has the effect of operating as the logged-in user.

This function can be used in ASP pages, VB, WSH, and in VBA code in Microsoft Office. View the code section below for more information, or view the demo.

VBScript Code

The code provides a single generic function listed below:
HTTPSessionRequest(method, url, data)

By using this function to retrieve web pages, the cookies and referrer headers are retained and the session state therefore persists between HTTP requests.

The following code demonstrates how the function can be used from within a VBS file on the desktop. Replace url1 with a login page, and url2 with a page which is protected by that login.


Option Explicit

Dim s, url1, url2
Dim data1, data2


'two requests to share the same session
url1 = "http://admin.estore-checkit.com/login/adminlogin.asp"
url2 = "http://admin.estore-checkit.com/export/orders.asp"

data1 = "uid=web&pwd=34325"
data2 = ""

'the 1st hit logs in...
s=HTTPSessionRequest("POST", url1, data1)
MsgBox s

'subsequent hits use the same session
s=HTTPSessionRequest("GET", url2, data2)
MsgBox s


Purchasing Options

The HTTP Session Request function is available as a VBScript function that can be used in your ASP pages and VB code. Click the button below to purchase:

HTTP Session Request: £20  
 

See Also

 Go ePDQ Integration
 Go WorldPay Integration
 Go thawteSSL Certificates
 Go Hosting - High Quality MS Professional
 

Keywords

HTTP session, ASP session, setRequestHeader, http headers, http cookies, asp cookie, http referrer, referer, http session, MSXML2, XMLhttp, XML, ASP pages, VB, WSH, VBA, Microsoft Office

Use our Internet Invoicing System to accept payment for invoicesInternet Payment Invoicing System

Our Internet Payment Invoicing System enables you to email a link to your clients and makes it easy to pay you online. Set up an online payment directly from MS Outlook. More info...

 Web-based Appointment Calendar Booking System - accept appointment bookings on your website Appointment Calendar Booking System

Web-based Appointment Calendar Booking System - fully customisable includes everything you need to accept appointment bookings and payments on your website. More info...

Top | Home | ECommerce | Hosting | Site Map | Search | © 2003-6 | Contact