Welcome to WebmasterWorld Guest from 54.167.0.111

Forum Moderators: ocean10000

Message Too Old, No Replies

Question about server.execute

     

graywolf

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

WebmasterWorld Senior Member 10+ Year Member



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.

wardbekker

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

10+ Year Member



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,

Jack_Straw

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

10+ Year Member



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.

graywolf

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

WebmasterWorld Senior Member 10+ Year Member



I tried the session varaible it worked perfectly, Thanx.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month