Skip To Main Content | Home | Sitemap | Contact
Latest Visitors: United States's flagUnited States's flagSweden's flagUnited States's flagUnited States's flagLatvia's flagParaguay's flagHungary's flagFrance's flagUnited States's flagKenya's flagUnited States's flagUnited States's flagUnited States's flagNetherlands's flagChina's flagChina's flagUnited States's flagUnited States's flagNetherlands's flagUnited States's flagUnited States's flagGermany's flagUnited States's flagNetherlands's flag
 

How can you communicate over HTTP with a web server from a client application?

In compiled ASP-VB or VB.NET you can use the XMLHTTP object.  You also can use that object in an ASP page (or even JavaScript in most browsers.)
The web site messages will appear here...



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<title>rodsdot.com :: simulation of client communication with web service</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005-2010 Roderick Divilbiss">
<script type="text/javascript">
var sending=false;

//create the Cross-browser XMLHttpRequest object
function getFile(pURL,pSend) {
  alert('Sending a request to rodsdot.com for userid: '+pSend);
  //if (!sending) {
  if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
    xmlhttp=new XMLHttpRequest();
    if (xmlhttp.overrideMimeType) {
      xmlhttp.overrideMimeType('text/xml');
    } 
    xmlhttp.onreadystatechange=postFileReady;
    xmlhttp.open("GET", pURL+'?userid='+pSend, true);
    xmlhttp.send(null);
  } else if (window.ActiveXObject) { //IE 
    xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
    if (xmlhttp) {
      xmlhttp.onreadystatechange=postFileReady;
      xmlhttp.open('GET', pURL+'?userid='+pSend, false);
      xmlhttp.send();
    }
  }
}

// function to handle asynchronus call
function postFileReady() {
  if (xmlhttp.readyState==4) { 
    if (xmlhttp.status==200) { 
      document.getElementById('theExample').innerHTML=xmlhttp.responseText;
    }
  }
}

</script>
</head>

<body>
<div id="theExample">The web site messages will appear here...</div>

<p><select size="1" name="userid" id="userid">
     <option>Select name to send</option>
     <option value="rdivilbiss">rdivilbiss</option>
     <option value="alangsk">alangsk</option>
     <option value="joesmoe">joesmoe</option>
     <option value="unknown">unknown</option>
   </select>&nbsp;
<input type="button" value="Send Request" onclick="getFile('http://www.domain.com/page.asp',document.getElementById('userid')[document.getElementById('userid').selectedIndex].value)"</p>
</body>
</html>


This Weeks Most Popular Pages Newest Pages