I'm newbie in ASP. I am trying to view multiple pages by using a single file.
For example,

I have a few pages of product.asp (products.asp, products1.asp and so on). Now I want to create a single single (products.asp) but can view multiple pages.

Try to search through google but not even sure what to search for.


There are different methods for using one file (product.asp) to display dynamic content.

One simple method is to select case based on the product ID sent to the page through the address: imagine you visit the page product.asp?product_id=1

Select Case Request.QueryString("product_id")
Case 1
Response.Write "Product 1"

Case Else 'no product is selected
Response.Write "<h3>Please select a product</h3>"
Response.Write "<a href=""product.asp?product_id=1"">Product 1 </a>"
End Select

Another method is to use SSI (Server Side Includes). You can include files based on the product ID retrieved from the querystring:

Select Case Request.QueryString("product_ID")

Case 1 %>
<!-- #Include File = "product1.asp" -->
<% Case 2 %>
<!-- #Include File = "product2.asp" -->

<% Case Else %>
<!-- #Include File = "product_overview.asp" -->

<% End Select %>

Based on this you can build a whole website, which is displayed in one page only!

Good luck, happy coding!


Sorry Baradaran... Can you elaborate more on the first solution? Where should I put that? Is it in the <body> part? Where should i assign the value to product_id?

If I use the second solution means i still have to create multiple products.asp file? I see in the coding I still to include a few products.asp file right?


hi!, what you need to do is use a database this will make things much easier to manage and will save page space. need with setting up a database driven page website ask me.

I already got a hosting server and database. The dynamic content part is also done now. Thanks for all the help given!!


This question has already been answered. Start a new discussion instead.