Home All Groups Group Topic Archive Search About


Author
5 Apr 2006 5:49 PM
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

Author
5 Apr 2006 6:02 PM
Bob Barrows [MVP]
abcd wrote:
> 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
http://www.aspfaq.com/show.asp?id=2173
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Author
5 Apr 2006 6:20 PM
abcd
thanks BOB

does this call CreateObject("MSXML2.ServerXMLHTTP")

requires any special components to be installed on the server

thanks



Bob Barrows [MVP] wrote:
Show quote
> abcd wrote:
>> 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
> http://www.aspfaq.com/show.asp?id=2173
Author
5 Apr 2006 6:48 PM
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



abcd wrote:
Show quote
> thanks BOB
>
> does this call CreateObject("MSXML2.ServerXMLHTTP")
>
> requires any special components to be installed on the server
>
> thanks
>
>
>
> Bob Barrows [MVP] wrote:
>> abcd wrote:
>>> 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
>> http://www.aspfaq.com/show.asp?id=2173

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Author
5 Apr 2006 6:35 PM
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



Bob Barrows [MVP] wrote:
Show quote
> abcd wrote:
>> 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
> http://www.aspfaq.com/show.asp?id=2173
Author
5 Apr 2006 7:48 PM
Bob Barrows [MVP]
abcd wrote:
Show quote
> 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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Author
5 Apr 2006 6:04 PM
Glenn Hanna
I'm not sure how to retrieve that string but you could try Response.Redirect


Show quote
"abcd" <a***@abcd.com> wrote in message
news:%23BT5SlNWGHA.1084@TK2MSFTNGP04.phx.gbl...
> 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
>
>

AddThis Social Bookmark Button