PDA

View Full Version : Server Execute Inc File Issue


theflyingminstr
03-22-2009, 07:12 PM
Hi the file link_inc.asp writes a value based on several database queries. I am trying to get the script below to read this as a string rather than writing the query values out in the document but when I try .. = "& Server.Execute("link_inc.asp") &" then.. I get an expected then error.


<%If "?" & Request.ServerVariables("QUERY_STRING") = Server.Execute("link_inc.asp") then%>

Old Pedant
03-22-2009, 09:13 PM
Not even close to possible.

Server.Execute actually executes a *COMPLETELY SEPARATE* ASP page. It does *NOT* share any variables or functions with anything on the page it is invoked from *except* the IIS global objects. To wit, Response and Request and Application and Session.

The *BEST* you could do would be to have link_inc.asp put the value it finds into some session variable and then retrieve it from there in the "home" page.

That is:

<%
...
Server.Execute "link_inc.asp"
valueFromLinkInc = Session("foobar") ' or whatever name
...
%>

You should know that Server.Execute is a performance hog, best avoided on busy sites, though fine to use on an occasional basis in less busy sites.

Didn't you notice that "link_inc.asp" could only "write" its value to the browser?? That is, if you do
Response.Write foo
inside a server.executed page, it *DOES* go on out to the browser. It is NOT held in memory any place.

theflyingminstr
03-22-2009, 10:06 PM
I was hoping you'd pass by this post OP, thanks again for your help!