Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Include: Dynamic FileName
     [next Lesson]  Include/Redirects: New Win2k Commands

Includes - Other Sites/Dynamic FileNames

3rd party components like ASPHTTP can grab the HTML contents of a specific URL into an ASP string. Supports GET/POST/HEAD documents via the HTTP protocol, examining response headers, transfering requests to a file (including binary transfers) and password authentication support. They can also be used on YOUR OWN SITE to make dynamic includes possible.

available at http://www.serverobjects.com/products.htm

Microsoft includes WinInet which seems to be ideally suited for this EXCEPT is currently not thread safe, see:
http://www.learnasp.com/advice/threadsafe.asp
so Tools like ASPHTTP are a necessity.

Here is a sample where ASPHTTP is used to grab contents from another site.

   filename=/learn/test/asphttpother.asp

<Test Script Below>


<html><head>
<title>asphttpother.asp</title>
</head>
<body>
<%
   Set HttpObj = Server.CreateObject("AspHTTP.Conn")

   HttpObj.Url = "http://www.funinspace.com"
   strResult = HttpObj.GetURL
   
   STRresult=server.htmlencode(STRresult)
   response.write STRresult

   SET HTTPobj = nothing
%>
</body>
</html>


Here is a sample where ASPHTTP is used to allow a string to decide  which page on our site is executed.

   filename=/learn/test/asphttpdynamic.asp

<Test Script Below>


<html><head>
<title>asphttpdynamic.asp</title>
</head>
<body bgcolor="#FFFFFF">
<%
    mystring="/learn/test/response.asp"

   Set HttpObj = Server.CreateObject("AspHTTP.Conn")
   HttpObj.Url = "http://www.learnasp.com" & mystring
   strResult = HttpObj.GetURL
   response.write STRresult

   SET HTTPobj = nothing
%>
</body>
</html>


Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site