Download ActiveSocket Network Communications Toolkit 4.1  (5105 KB - .exe file)
Download Manual  (505 KB - .htm file)
ASP 2.x HTTP Get and HTTP Post Sample Source Code
ActiveSocket provides an easy-to-use development interface to a variety of IP protocols.
By using ActiveSocket, you can very easily create or enhance applications with network features.
ActiveSocket features the following: ICMP, HTTP and HTTPs with support for proxy servers and secure web sites, Telnet, NTP time protocol, RSH remote shell script interface, SNMP (Simple Network Management Protcol), SNMP Traps, Sockets, WOL (Wake-On-LAN), and more.
HTTP Get and HTTP Post can be well integrated into ASP environments.
This document describes how the ActiveSocket Http object can be integrated into ASP projects.
The most important functions of the Http object are:
- Connect - connect to the (remote) HTTP web server on port 80 or any alternate port; optionally, use proxy credentials to use a proxy server; optionally, specify a web account and password for password protected web sites
- Disconnect - to diconnect after a connect call;
- ReadData - read all data from a web page;
- WriteData - write data to a web page.
Step 1: Download and install ActiveSocket
Download ActiveSocket from the ActiveXperts Download Site and start the installation.
The installation guides you through the installation process.
Step 2: Create a new Web Site
First, create a new directory on the IIS Server's file system. This directory will hold the ASP later on.
From the 'Start menu', click on 'Administrative Tools' and click on 'Internet Information Services (IIS) Manager'.
Right-click on the 'Web Sites' container and choose 'New->Web Site':

(Click on the picture to enlarge)
The 'Web Site Creation Wizard' is shown, guiding you thorugh the process of creating a new web site. Provide all necessary information:
- Description - a friendly description of the new site;
- IP / Port / Host Header - choose your preferred way to distinguish between other web sites on the server;
- Path - select the directory that will store the ASP file(s);
- Web Site Access Permissions - in the Web Site Access Permissions dialog, enable 'Read' and 'Run scripts (such as ASP)';
You're now able to write an ASP script to use IP protocols with ActiveSocket.
Step 3: Create the ActiveSocket object in ASP
Create a new ASP script called DEFAULT.ASP in the directory that was created in Step2, using your favorite editor.
On top of the ASP code, insert the following lines to declare and create the ActiveSocket object:
set objHttp = server.CreateObject("ActiveXperts.Http")
In this sample we have built a page that is able to display the source code of another page. To do this, we're using the following code.
if request("submitbutton") <> "" then
set objHttp = server.CreateObject("ActiveXperts.Http")
objHttp.WebAccount = request("webaccount")
objHttp.WebPassword = request("webpassword")
objHttp.Connect request("url")
strResult = objHttp.LastError & " : " & objHttp.GetErrorDescription(objHttp.LastError)
strHttpData = objHttp.ReadData
objHttp.Disconnect
end if
You'll probebly notice the webaccount and password. We need those when we're trying to get code from a secured site. When you're connected to the site
all you have to do now is read the data. If you just want to preview source code, make sure you convert <'s and >'s, you'ld also like to convert
line breaks and returns. To convert these characters, use this code:
strHttpData = replace(strHttpData,chr(60),"<")
strHttpData = replace(strHttpData,chr(62),">")
strHttpData = replace(strHttpData,chr(13),"<br>")
The ActiveSocket tool is a Network Communications ActiveX software component (SDK).
This control supports SNMP, SMTP, POP3, Telnet, TCP, NTP, RSH, HTTP, HTTPs, FTP, DNS, ICMP and more, and can be used by any Windows development platform,
including Visual Basic .NET, Visual CSharp .NET,
ASP .NET (VB,CS),
ASP,
Visual Basic,
Visual Studio/Visual C++,
Delphi,
PHP,
ColdFusion,
HTML,
VBScript and any other ActiveX/COM compliant platform. The ActiveSocket Toolkit is an ActiveXperts Software B.V. Product.
|