homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

Question about server.execute

 6:04 pm on Feb 3, 2003 (gmt 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)


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)

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)

I tried the session varaible it worked perfectly, Thanx.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved