Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - server.execute?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

server.execute?

 Post Reply Post Reply
Author
longcall911 View Drop Down
Newbie
Newbie


Joined: 02 October 2004
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote longcall911 Quote  Post ReplyReply Direct Link To This Post Topic: server.execute?
    Posted: 08 August 2005 at 4:28pm
Although I've been doing some very basic (no pun intended) scripting with asp for a while now, I've never tried the server.execute command before.
 
I recently moved all my DSN connections into external files where they will be easier to change when I switch to a MySql db.
 
I then replaced the on-page connection code with HTML include directives for the appropriate external file for that connection.  That of course forces the server to exit the script engine, process the html, and return to scripting.
 
I've now realized that server.execute is supposed to transfer to the file in the argument, run that code, and transfer back to the origination point.  I have tried using something like server.execute("myIncludeFile.asp") but code in the target file is not running.
 
I can server.transfer("myIncludeFile.asp") and target code runs fine.  But of course, that's just half of what I'm trying to do.
 
Any help with what I'm doing wrong is appreciated.
 
/*tom*/
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 08 August 2005 at 6:29pm
If server.transfer works, server.execute should. Can't call it with any query string though although the query string parameters in the container script are available to it and not to server.transfer (or is it the other way around ?).

Try putting a response.write "XXXXX" at the beginning of myIncludeFile.asp just to confirm that the execute is not getting there.


Edited by dpyers - 08 August 2005 at 6:30pm

Lead me not into temptation... I know the short cut, follow me.
Back to Top
longcall911 View Drop Down
Newbie
Newbie


Joined: 02 October 2004
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote longcall911 Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2005 at 10:27pm
I finally got back to this issue and tried a response.write as suggested.  Yep, it works, although not completely as I had expected.
 
The problem is that if a assign a value to a variable in the second file and try to use the variable in the first file once control is returned, the variable is empty.
 
I was expecting that the code in the second page would be treated exactly as though it existed in the first page.  Rather, it behaves like a sub with variables being local even if they are declared in the first page (equivalent of global).
 
So server.transfer is less functional to me than I thought it would be, but still worth using in a number of situations.
 
Thanks, for the help....
 
/*tom*/
 
 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2005 at 11:12pm
Server.Transfer and Server.Execute run in a new separate memory space. Variables declared in the original memory space are not available to them. In the case of Server.Transfer, the original memory space is in fact wiped out.

If I remember right though, Server.Execute passes access to the request object of the original script. For example...

Suppose A.asp Server.Executes B.asp
If you execute A.asp through a post or query (A.asp?X=123) then B.asp also has access to the value of X - Request("X")


Lead me not into temptation... I know the short cut, follow me.
Back to Top
longcall911 View Drop Down
Newbie
Newbie


Joined: 02 October 2004
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote longcall911 Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2005 at 2:46pm
I have tried and found that yes, request objects (form and quesrystring in particular) are available on the executed page.
 
This makes server.execute a bit more useful to what I'm doing with it.
 
Thanks again, dpyers.
 
/*tom*/
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.