Probably stupid ASP question
Hello, this is probably a stupid question but I am going to try anyway (and no, this isn't a homework question).
Is there anyway to get the output from one webpage, store it in a variable and then spit that out in the current page?
The situation that I have is I have a template that is a bunch of ASP, and I have a database query (written with Cold Fusion) that is on a different server. I want to be able to have the ASP stuff be like a wrapper around the CF query. Right now the CF just spits out some simple HTML, I want to be able to capture that and spit it out via the ASP page.
Any ideas on how to do this?
Ray
Wednesday, October 1, 2003
You can use XMLHTTP to accomplish this, it's part of the MSXML SDK:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp
Specifically:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp
Matthew Lee
Wednesday, October 1, 2003
Do not use XMLHTTP. It is designed for use on a client machine only.
However, there is 'Server' XMLHTTP which you can use. Same interface, slightly different underlying code. Here's an article turned by by google (assuming you know the right keywords):
http://www.eggheadcafe.com/articles/20010209.asp
mb
Wednesday, October 1, 2003
Maybe Im missing the point, but wouldnt simply including the CF page in the ASP page work?
Eric DeBois
Wednesday, October 1, 2003
I am not really a web guy (obviously) but I think the problem is that the database that the CF queries is on a different server than the ASP page. Also, the CF server software doesn't live on the server that the ASP pages are on. I know it is probably a stupid way of doing things and the easier thing would be to move the ASP stuff to the CF server but I am not sure if we will run into other problems when doing that.
I will take a look at those articles. Thanks for the info.
Ray
Wednesday, October 1, 2003
Ray,
You are most likely needing to use ASP to parse the HTML generated by the CF page.
* Assuming the CF page prints some data given a querystring URL: query.cfm?iq=bagels
* send valid parameters as an HTTP request to the CF Web server using an HTTP client embedded in your ASP script (XMLHTTP)
* parse and display the HTTP response as ASP variables.
mb points you towards Web services, which is similar but more of a complex and permanent solution. Your CF app would have to learn to talk a little XML as well.
As to why you shouldn't use XMLHTTP, mb, can you clarify? I've seen the code in use, it certainly works. We use it to "print this page".
http://www.4guysfromrolla.com/webtech/110100-1.shtml
Matthew Lee
Wednesday, October 1, 2003
true, the article discusses web services, it's just the first example of serverxmlhttp in asp found in my google search.
here's info on server xmlhttp. i think you can just change the clsid or other reference from xmlhttp to sxmlhttp, and your code will continue to work, just in a more reliable fashion:
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xml_obj_iserverxmlhttprequest_7zlc.asp
note that there is also both wininet and wininets, one runs on a client and has client-like features, the other runs on the server and trades features for performance, reliablity, and security.
(I just looked at the 4guysfromrolla page. it has the serverxmlhttp in a comment, it should use it by default and maybe comment about the original xmlhttp in case the developer is forced to use pre-2000 versions of MSXML.)
mb
Wednesday, October 1, 2003
Thanks for the info guys. I am currently looking at that last article posted by mb, it looks like that is pretty close to what I want to do. I am going to try it out later today.
Thanks again.
Ray
Thursday, October 2, 2003
uhm, I think eric's right. Use an include virtual.
Vince
Thursday, October 2, 2003
Recent Topics
Fog Creek Home
|