How to Show html page from Asp (Help Urgent)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: How to Show html page from Asp (Help Urgent)

  1. #1
    Bahi Guest

    How to Show html page from Asp (Help Urgent)


    Hi

    I want to select one html page from an asp page and show it to the user
    after he select one of them from the list

    Bahi

    Many thanks in advance

  2. #2
    Russell Jones Guest

    Re: How to Show html page from Asp (Help Urgent)

    You have two options:

    1. (Simplest) Format the list of pages as links where the href attribute
    value is the URL of the page you want to show.
    2. If you don't want them to know where the HTML pages are, format the link
    so it returns the user's choice to a page that:
    (a) retrieves the user's choice from a Request variable
    (b) creates a physical file name string
    (c) reads the contents of that file using the FileSystemObject and
    TextStream objects into a string
    (d) Use Response.Write to write the contents of the string back to the
    client.

    "Bahi" <bziane@hotmail.com> wrote in message
    news:3a7ce828$1@news.devx.com...
    >
    > Hi
    >
    > I want to select one html page from an asp page and show it to the user
    > after he select one of them from the list
    >
    > Bahi
    >
    > Many thanks in advance




  3. #3
    Bahi Guest

    Re: How to Show html page from Asp (Help Urgent)


    Please, can you give more details (Sample code)

    Many thanks


    "Russell Jones" <arj1@northstate.net> wrote:
    >You have two options:
    >
    >1. (Simplest) Format the list of pages as links where the href attribute
    >value is the URL of the page you want to show.
    >2. If you don't want them to know where the HTML pages are, format the link
    >so it returns the user's choice to a page that:
    > (a) retrieves the user's choice from a Request variable
    > (b) creates a physical file name string
    > (c) reads the contents of that file using the FileSystemObject and
    >TextStream objects into a string
    > (d) Use Response.Write to write the contents of the string back to the
    >client.
    >
    >"Bahi" <bziane@hotmail.com> wrote in message
    >news:3a7ce828$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I want to select one html page from an asp page and show it to the user
    >> after he select one of them from the list
    >>
    >> Bahi
    >>
    >> Many thanks in advance

    >
    >



  4. #4
    Russell Jones Guest

    Re: How to Show html page from Asp (Help Urgent)

    1. List of links:

    <table>
    <tr>
    <td>
    <a href="link1.htm">File 1</a><br>
    <a href="link2.htm">File 2</a><br>
    <a href="link3.htm">File 3</a>
    </td>
    </tr>
    </table>

    Substitute your own URLs and file names in the preceding example.

    2. Retrieve choice:

    CLIENT:
    <table>
    <tr>
    <td>
    <a href="getFile.asp?file=file1.htm">File 1</a><br>
    <a href="getFile.asp?file=file2.htm">File 2</a><br>
    <a href="getFile.asp?file=file3.htm">File 3</a>
    </td>
    </tr>
    </table>


    SERVER:
    dim filename
    dim pathToFiles
    dim fs
    dim ts
    dim s
    ' real (hidden) path to file content
    pathToFiles="C:\myserver\mypath\"

    ' filename user clicked from preceding CLIENT code
    filename=Request("file")

    ' open the appropriate file
    set fs = Server.CreateObject("Scripting.FileSystemObject")
    set ts = fs.openTextFile(pathToFiles & filename)

    ' read the contents
    s = ts.readAll

    ' clean up
    ts.close
    set ts = nothing
    set fs = nothing

    ' send back the file contents
    Response.write s
    Response.end

    Again, you'll need to substitute your own path and file names in the
    preceding code.

    "Bahi" <bziane@hotmail.com> wrote in message news:3a7ec84f@news.devx.com...
    >
    > Please, can you give more details (Sample code)
    >
    > Many thanks
    >
    >
    > "Russell Jones" <arj1@northstate.net> wrote:
    > >You have two options:
    > >
    > >1. (Simplest) Format the list of pages as links where the href attribute
    > >value is the URL of the page you want to show.
    > >2. If you don't want them to know where the HTML pages are, format the

    link
    > >so it returns the user's choice to a page that:
    > > (a) retrieves the user's choice from a Request variable
    > > (b) creates a physical file name string
    > > (c) reads the contents of that file using the FileSystemObject and
    > >TextStream objects into a string
    > > (d) Use Response.Write to write the contents of the string back to

    the
    > >client.
    > >
    > >"Bahi" <bziane@hotmail.com> wrote in message
    > >news:3a7ce828$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I want to select one html page from an asp page and show it to the user
    > >> after he select one of them from the list
    > >>
    > >> Bahi
    > >>
    > >> Many thanks in advance

    > >
    > >

    >




  5. #5
    Bahi Guest

    Re: How to Show html page from Asp (Help Urgent)


    Hi,

    Ok, Many Thanks




    "Russell Jones" <arj1@northstate.net> wrote:
    >1. List of links:
    >
    ><table>
    > <tr>
    > <td>
    > <a href="link1.htm">File 1</a><br>
    > <a href="link2.htm">File 2</a><br>
    > <a href="link3.htm">File 3</a>
    > </td>
    > </tr>
    ></table>
    >
    >Substitute your own URLs and file names in the preceding example.
    >
    >2. Retrieve choice:
    >
    >CLIENT:
    ><table>
    > <tr>
    > <td>
    > <a href="getFile.asp?file=file1.htm">File 1</a><br>
    > <a href="getFile.asp?file=file2.htm">File 2</a><br>
    > <a href="getFile.asp?file=file3.htm">File 3</a>
    > </td>
    > </tr>
    ></table>
    >
    >
    >SERVER:
    >dim filename
    >dim pathToFiles
    >dim fs
    >dim ts
    >dim s
    >' real (hidden) path to file content
    >pathToFiles="C:\myserver\mypath\"
    >
    >' filename user clicked from preceding CLIENT code
    >filename=Request("file")
    >
    >' open the appropriate file
    >set fs = Server.CreateObject("Scripting.FileSystemObject")
    >set ts = fs.openTextFile(pathToFiles & filename)
    >
    >' read the contents
    >s = ts.readAll
    >
    >' clean up
    >ts.close
    >set ts = nothing
    >set fs = nothing
    >
    >' send back the file contents
    >Response.write s
    >Response.end
    >
    >Again, you'll need to substitute your own path and file names in the
    >preceding code.
    >
    >"Bahi" <bziane@hotmail.com> wrote in message news:3a7ec84f@news.devx.com...
    >>
    >> Please, can you give more details (Sample code)
    >>
    >> Many thanks
    >>
    >>
    >> "Russell Jones" <arj1@northstate.net> wrote:
    >> >You have two options:
    >> >
    >> >1. (Simplest) Format the list of pages as links where the href attribute
    >> >value is the URL of the page you want to show.
    >> >2. If you don't want them to know where the HTML pages are, format the

    >link
    >> >so it returns the user's choice to a page that:
    >> > (a) retrieves the user's choice from a Request variable
    >> > (b) creates a physical file name string
    >> > (c) reads the contents of that file using the FileSystemObject and
    >> >TextStream objects into a string
    >> > (d) Use Response.Write to write the contents of the string back to

    >the
    >> >client.
    >> >
    >> >"Bahi" <bziane@hotmail.com> wrote in message
    >> >news:3a7ce828$1@news.devx.com...
    >> >>
    >> >> Hi
    >> >>
    >> >> I want to select one html page from an asp page and show it to the

    user
    >> >> after he select one of them from the list
    >> >>
    >> >> Bahi
    >> >>
    >> >> Many thanks in advance
    >> >
    >> >

    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center