calling another page

A

abcd

How can I call one ASP page from another

Page1.asp returns me some strings in the form of response.write

Page2.asp will call page1.asp and use that long string returned from
page1.asp....

How can I do that

thanks
 
G

Glenn Hanna

I'm not sure how to retrieve that string but you could try Response.Redirect
 
A

abcd

thanks BOB

does this call CreateObject("MSXML2.ServerXMLHTTP")

requires any special components to be installed on the server

thanks
 
A

abcd

I have written the code as below

sURL = "http://localhost/test/test.asp"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", sURL, false
xmlhttp.send ""
y = xmlhttp.responseText
set xmlhttp = nothing


test.asp looks like as below

<%
Response.ContentType = "application/text"
Response.Write("hello World")
Response.End
%>


my variable y doesnt get the string "hello World"

whats wrong in above code
 
B

Bob Barrows [MVP]

The MSXML Parser is probably already there, but yes, the MSXML Parser needs
to be installed.

Your only other option is to replace the response.writes in the other page
with assignments to string variables and use an SSI instead. With a SSI,
string variables in the included page are accessible to "host" page
(page2.asp). Better yet, create functions in page1.asp that return the
string values, individually, or in an array:

page1.asp:
<%
'instead of
'response.write "one"
'response.write "two"
'do this:
function GetStrings()
ar = array("one", "two")
GetStrings=ar
end function
%>

Page2.asp:
<!-- #include virtual="page1.asp" -->
<%
ar=GetStrings
response.write join(ar,"; ")
%>


Even better, use a class in the included page ...

Bob Barrows
 
B

Bob Barrows [MVP]

abcd said:
I have written the code as below

sURL = "http://localhost/test/test.asp"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", sURL, false
xmlhttp.send ""
y = xmlhttp.responseText
set xmlhttp = nothing


test.asp looks like as below

<%
Response.ContentType = "application/text"
Response.Write("hello World")
Response.End
%>


my variable y doesnt get the string "hello World"

whats wrong in above code

i don't see anything wrong in the code. Is it timing out? If so, this means
you are sending a request to a file in the same virtual directory as the
calling file. They need to be different web sites

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top