Connecting Tech Pros Worldwide Help | Site Map

Viewing multiple ASP pages by using single ASP file

Newbie
 
Join Date: Oct 2008
Posts: 2
#1: Oct 20 '08
Hi,

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.


Help??
danp129's Avatar
Expert
 
Join Date: Jul 2006
Posts: 250
#2: Oct 20 '08

re: Viewing multiple ASP pages by using single ASP file


Not sure what you're looking for but i'll take a guess...

When you see a page that the filename doesn't change but it can show many different products based on the query string (product.asp?prod_id=###) that means it is a dynamic page that pulls information out of something, typically a database, such as access, mysql, mssql, etc, but sometimes a text file such as CSV or XML or XLS. Microsoft Access and Microsoft SQL Server are the most common database people use with ASP.

NOT RECOMMENDED, but if there are very few products (10 or so), you might just use FSO to read the contents of a static html file. This method could be used to buy time before switching to database driven website. FSO method would look something like this:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim ofs, ofile
  3. dim prod_id : prod_id=request.querystring("prod_id")
  4. select case prod_id
  5.   case 1
  6.     sFileName="product1.html"
  7.   case 2
  8.     sFileName="product2.html"
  9.   case 3
  10.     sFileName="product3.html"
  11.   case else
  12.     'load product1 by default
  13.     sFileName="product1.html"
  14. end select
  15.  
  16. Set ofs=Server.CreateObject("Scripting.FileSystemObject")
  17. Set ofile=ofs.GetFile(server.MapPath(sFileName))
  18. Response.Write(ofile.ReadAll)
  19. ofile.close
  20. set ofile=nothing
  21. set ofs=nothing
  22.  
  23. %>
  24.  
Reply


Similar ASP / Active Server Pages bytes