asp include files from different server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeffish
    New Member
    • May 2006
    • 1

    asp include files from different server

    Does anyone know if you can include files from another server/domain?

    ie: <!-- #include file="http://www.someotherdomain.com/file.inc" -->

    Thank you
  • Niheel
    Recognized Expert Moderator Top Contributor
    • Jul 2005
    • 2432

    #2
    I don't think that can be done. Code files are interpreted on the local server, so the display would be blank. Not only that; there would definitely be some security issues involved with that.
    niheel @ bytes

    Comment

    • johnnyc3po
      New Member
      • Dec 2006
      • 1

      #3
      Originally posted by jeffish
      Does anyone know if you can include files from another server/domain?

      ie: <!-- #include file="http://www.someotherdomain.com/file.inc" -->

      Thank you

      Yes, you have to use XMLHTTP

      Something like this..

      <%
      Response.Buffer = True
      Dim objXMLHTTP, xml

      ' Create an xmlhttp object:
      Set xml = Server.CreateOb ject("Microsoft .XMLHTTP")
      ' Or, for version 3.0 of XMLHTTP, use:
      ' Set xml = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")

      ' Opens the connection to the remote server.
      xml.Open "GET", "http://pathToIncludeOn Differentserver ", False

      ' Actually Sends the request and returns the data:
      xml.Send

      'Display the HTML
      Response.Write xml.responseTex t


      Set xml = Nothing
      %>

      Comment

      Working...