faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 46 people (39%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I include an ASP page in another ASP page with QUERY STRING.

Mar 12th, 2003 12:57
Chris White, Yves Goldberg,


to include 1 asp page in another use #include, e.g.
<!-- #include file="page2.asp -->
unfortunatly these includes are determined at compile time, so the line
<!-- #include file=Request.QueryString("page") -->
would not work as at compile time, the Request object is not available 
to the compiler.
The only way around this is to use a select case statement in your 
code, e.g.
<%
page = Request.QueryString("page")
select case page
  case "page1"
    <!-- #include file="page1.asp" -->
  case "page2"
    <!-- #include file="page2.asp" -->
  case "page3"
    <!-- #include file="page3.asp" -->
  case else
    <!-- #include file="page4.asp" -->
end select
%>
Note this method is no different than just having all the code from 
pages 1-4 pasted in between the case statements, and will not save any 
compile time of the ASP page.



© 1999-2004 Synop Pty Ltd