Welcome to WebmasterWorld Guest from 54.158.197.37

Forum Moderators: ocean10000

Message Too Old, No Replies

Question about server.execute

     
6:04 pm on Feb 3, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 28, 2002
posts:1324
votes: 0


I am trying to do a server.execute to build into an existing string but am not having any success, and am wondering if this is even possible, here is my pseudo code:

str_text = str_text "<br>blah 1 "
if cond1 = true then
sever.execute ("file1.asp")
end if
str_text = str_text & "<br>blah 3"

file1.asp looks like this

str_text = str_text & "blah2"

I get the "blah 1" and "blah 3" but not the "blah 2". I tried issusing a response.write directly in file1.asp to make sure I am getting there and I am.

6:21 pm on Feb 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Dec 13, 2001
posts:285
votes: 0


graywolf,

With server.execute the variables on the calling page are not in scope of the executed asp page.

If you keep the variable in the session object (Session("str_text")) than it should work,

6:26 pm on Feb 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 18, 2002
posts:126
votes: 0


You will not be able to do that. The server.execute is different than a simple include. The code in the execute call runs in a different space than the caller. You cannot easily pass information from the caller to the called code. In particular, variables are not shared. An option explicit statement at the top of the called code will help make this more apparent. The str_text variable in the called file does not refer to the same str_text variable in the calling file.

You can pass information between between the two files with cookies, session variables, or, possibly the database. Any other approach is problematic.

6:38 pm on Feb 3, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 28, 2002
posts:1324
votes: 0


I tried the session varaible it worked perfectly, Thanx.