Results 1 to 5 of 5

Thread: asp connection by using fixed path ??

Threaded View

  1. #3
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: asp connection by using fixed path ??

    Another option is this ..

    If you can place an ASP page on the remote server ..

    Local Server Page ..

    xHttp.asp
    Code:
    <%@ Language="VBScript" %> 
    <%
    Option Explicit
    
    '// SET RESPONSE HEADERS
    Response.Buffer = True
    Response.Expires = 0
    Response.ExpiresAbsolute = Now() - 1
    Response.AddHeader "cache-control","private"
    Response.AddHeader "pragma", "no-cache"
    
    Dim objHttp
    Dim strText
    Dim strURL
    Dim strStatus
    Dim strResults
    
    strURL = "http://www.mywebsite.com/xHttpRec.asp?action=get&id=24"
    
    '// GET A REMOTE WEB PAGE
    Function RemoteData()
    	Dim strData
    	On Error Resume Next
    	Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    	objHttp.Open "GET", strURL, False
    	objHttp.setRequestHeader "Content-Type", "text/html"
    	If Err = 0 Then
    		objHttp.send
    		strStatus = objHttp.Status
    		strResults = objHttp.StatusText
    		strData = objHttp.ResponseText
    	End If
    	Set objHttp = Nothing
    	If Err <> 0 Then
    		strData = "Error " & Err.Number & "<br>" & _
    		Err.Description & vbCrLf
    	End If	
    	RemoteData = strData
    End Function
    
    '// GET PAGE NOW
    strText = RemoteData
    
    '// RESPONSE ERROR
    If strStatus >= 400 And strStatus <= 500 Then
    	Response.Write "Error " & strStatus & "<br>"
    	Response.Write strResults & vbCrLf
    	Response.End	
    '// SHOW DATA FROM PAGE
    Else
    	Response.Write strText
    End If
    
    %>

    Remote Page (Database Location)
    Very Simple Example.

    xHttpRec.asp
    Code:
    <% Response.Write "Okay" %>
    See this link for a more detailed example ..
    http://www.vbforums.com/showthread.p...70#post2477670
    Last edited by rory; Jun 10th, 2006 at 09:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width