Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    passing variables to sub-page using server.execute

    i'm using server.execute() to include a sub-page within another page, however I would like to be able to pass variables to the sub-page from the main page. can this be done with server.execute()?
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk

  • #2
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    I don't think you can.
    I ran some tests but I don't know how to do it.

    However, you can use <!--#INCLUDE FILE="file.asp" -->
    But you need SSI, and you probibly have it on your server, so it's worth a try.

    Any variable made before the include, can be used and changed and whatever inside of file.asp.

    Tell me if this works.

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    #include server.execute and server.transfer all transfer the page state over (with all the variables) but for some reason only #include seems to transfer functions you have made on the original file *shrugs*

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any form variables, query string variables that were available to the original page should be available to the page transfered to via server.execute, methinks.


    fv

  • #5
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Quote Originally Posted by fractalvibes
    Any form variables, query string variables that were available to the original page should be available to the page transfered to via server.execute, methinks.


    fv
    I tried it, and it doesn't seem to work for me.

    I added my own string variables to this little example here:
    http://docs.sun.com/source/817-2514-...uiltIn143.html

  • #6
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    works fine for me, im using iis 6 not chillisoft though, heres the code i ran:
    (the page run was ServerExecute.asp?page=requeststuff.asp)

    ServerExecute.asp:
    Code:
    <%
    Response.Write "on page 1, transfering to page2:<hr>"
    Server.Execute(Request.QueryString("page"))
    Response.Write "<hr>back on page 1"
    %>
    requeststuff.asp:
    Code:
    Request.QueryString = '<%=Request.QueryString%>'<br>
    Request.Form = '<%=Request.Form%>'
    and heres the result:
    on page 1, transfering to page2:
    --------------------------------------------------------------------------------
    Request.QueryString = 'page=requeststuff.asp'
    Request.Form = ''
    --------------------------------------------------------------------------------
    back on page 1

  • #7
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Quote Originally Posted by ghell
    works fine for me, im using iis 6 not chillisoft though, heres the code i ran:
    (the page run was ServerExecute.asp?page=requeststuff.asp)

    ServerExecute.asp:
    Code:
    <%
    Response.Write "on page 1, transfering to page2:<hr>"
    Server.Execute(Request.QueryString("page"))
    Response.Write "<hr>back on page 1"
    %>
    requeststuff.asp:
    Code:
    Request.QueryString = '<%=Request.QueryString%>'<br>
    Request.Form = '<%=Request.Form%>'
    and heres the result:
    That's not what he meant.

    He meant this:

    Page1.asp
    Code:
    <%
    Dim strVar
    strVar = "This Text"
    Response.Write("Page 1 <br>")
    Server.Execute("page2.asp")
    Response.Write("Page 1 check: """ & strVar & """")
    %>
    Page2.asp
    Code:
    <%
    Response.Write("Page 2 <br>")
    Response.Write("Page 2 check: """ & strVar & """<br>")%>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •