471,852 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

Calling an asp script from an asp script

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?
Jul 19 '05 #1
4 1513
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")
Jul 19 '05 #2

"dlbjr" <oo**@iforgot.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Jul 19 '05 #3
For more information, including the preferred progid (MSXML2.ServerXMLHTTP
vs. Microsoft.XMLHTTP), see http://www.aspfaq.com/2173

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Simon Wigzell" <si**********@shaw.ca> wrote in message
news:BZdnc.393996$Pk3.91251@pd7tw1no...

"dlbjr" <oo**@iforgot.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.

Jul 19 '05 #4
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
"Simon Wigzell" <si**********@shaw.ca> wrote in message
news:xCbnc.392339$Pk3.376438@pd7tw1no...
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?

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by deko | last post: by
12 posts views Thread by bhennon | last post: by
8 posts views Thread by Vinod | last post: by
8 posts views Thread by Brett Robichaud | last post: by
3 posts views Thread by Anthony Smith | last post: by
4 posts views Thread by raghuvendra | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.