Calling an asp script from an asp script

S

Simon Wigzell

My webpage assembles data from a database for display as an html webpage. I
would to have the ability for my clients to have custom scripts to control
the display. I would like the behaviour of just including the script e.g.:

<!--#include file="MyScript.asp" -->

but the problem is I don't know what the name of the script is until "run
time". Can I somehow call a function from an asp file that is in another asp
page and return a value to the calling page? The value would just be the
display string for the data.

So my main asp page would get the name of the asp page containing the
function as an argument and somehow execute and response.write the returned
string. Is this possible?
 
D

dlbjr

Public Function ProcessUrl(strUrlAddress)
ProcessUrl = ""
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.open "GET",strUrlAddress, false
objXMLHTTP.send
ProcessUrl = objXMLHTTP.ResponseText
Set objXMLHTTP = Nothing
End Function

Response.Write ProcessUrl("http://www.server.com/whatever.asp")
 
S

Simon Wigzell

dlbjr said:
Public Function ProcessUrl(strUrlAddress)
ProcessUrl = ""
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.open "GET",strUrlAddress, false
objXMLHTTP.send
ProcessUrl = objXMLHTTP.ResponseText
Set objXMLHTTP = Nothing
End Function

Response.Write ProcessUrl("http://www.server.com/whatever.asp")
Wow! Fantastic, thanks! I thought I was trying to do the impossible.
 
L

Lance Wynn

Server.Execute("Myscript.asp") on iis 5.0 will work. The bonus is that all
the user information (Cookies, HTTP Headers,etc...) will be visible to the
second script. Using the XMLHttp will cause the Server to act as the
client, and any client side info will not be visible to the second script.

Lance


My webpage assembles data from a database for display as an html webpage. I
would to have the ability for my clients to have custom scripts to control
the display. I would like the behaviour of just including the script e.g.:

<!--#include file="MyScript.asp" -->

but the problem is I don't know what the name of the script is until "run
time". Can I somehow call a function from an asp file that is in another asp
page and return a value to the calling page? The value would just be the
display string for the data.

So my main asp page would get the name of the asp page containing the
function as an argument and somehow execute and response.write the returned
string. Is this possible?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top