View Single Post
  #1 (permalink)  
Old 10-09-09, 03:16 PM
HammondEgger HammondEgger is offline
New Member
 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Spin MSXML2.ServerXMLHTTP -- can't call self

Hi Everyone,

I recently ran into a problem that other ASP developers have come across when trying to make use of MSXML2.ServerXMLHTTP. What I am trying to do is have my site read a page -- with arguments passed -- and then make that page the body of an e-mail.

Here's my code

vb Code:
  1. qpos = instr(myURL,"?")
  2. if qpos > 0 then
  3.     'If there is a ?, it means there are arguments so do this
  4.     base_url = "http://" & mid(myURL,1,qpos-1)        'the URL without args
  5.     args = mid(myURL,qpos+1)                    'The rest of the args
  6.     'Make the call...
  7.     set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
  8.     xmlhttp.open "GET", base_url, false
  9.         xmlhttp.send args
  10.         myMail.HTMLBody = xmlhttp.responseText
  11.         set xmlhttp = nothing
  12. else
  13.     myMail.CreateMHTMLBody myURL        'Get the body from this page...no args
  14. end if

The problem, from what I've read, centers around the functionality of MSXML2.ServerXMLHTTP which prevents it from being used to connect to its own address. So, I can read the contents of other site's pages, but not my own.

I need this ability since the pages are not just used as e-mail content, they are pages that people look at directly from time to time so I'd like to use those pages rather than have two sets of display code for the output.

Can anyone suggest a workaround for me or let me know what I'm doing wrong?

Thanks!
Reply With Quote