Viewing multiple ASP pages by using single ASP file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raul15791
    New Member
    • Oct 2008
    • 2

    Viewing multiple ASP pages by using single ASP file

    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
    Recognized Expert Contributor
    • Jul 2006
    • 323

    #2
    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?pr od_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:

    [code=asp]
    <%
    Dim ofs, ofile
    dim prod_id : prod_id=request .querystring("p rod_id")
    select case prod_id
    case 1
    sFileName="prod uct1.html"
    case 2
    sFileName="prod uct2.html"
    case 3
    sFileName="prod uct3.html"
    case else
    'load product1 by default
    sFileName="prod uct1.html"
    end select

    Set ofs=Server.Crea teObject("Scrip ting.FileSystem Object")
    Set ofile=ofs.GetFi le(server.MapPa th(sFileName))
    Response.Write( ofile.ReadAll)
    ofile.close
    set ofile=nothing
    set ofs=nothing

    %>
    [/code]

    Comment

    Working...