www.webdeveloper.com
Results 1 to 2 of 2

Thread: Opening Website - Looping

  1. #1
    Join Date
    Nov 2004
    Location
    Singapore
    Posts
    84

    Opening Website - Looping

    Let say I have a lot of weblinks in the format of:-

    1.) http://www.website.com/testing.asp?section=testing&ID=12345
    2.) http://www.website.com/testing.asp?section=testing&ID=12346
    3.) http://www.website.com/testing.asp?section=testing&ID=12347
    .
    .
    .
    .

    If I want to open up all the weblinks, assuming they are stored in a sequential file, line by line, how do I do it?

    Or even better, I only store the NUMBER section in the file and the web open command will concat the number at each loop. Is it viable to do it using ASP?
    Last edited by jacknbey; 06-07-2007 at 01:00 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    Winston-Salem, NC
    Posts
    318
    I believe this is what your looking for. The code's broken down into two files. The first the text file containing the values. The other is the asp page that displays the results. Obviously you'll need to change the code to fit your needs. Have fun!

    WebLinks.txt
    Code:
    12345
    23456
    34567
    45678
    56789
    67890
    Test.asp
    Code:
    <%
    Dim connTextFile
    Dim objWebNumbers
    Dim strNumber
    	
    Set connTextFile = CreateObject("Scripting.FileSystemObject")
    	
    Set objWebNumbers = connTextFile.OpenTextFile(Server.MapPath("/WebLinks.txt"))
    	
    Do While Not objWebNumbers.AtEndOfStream
       strNumber = objWebNumbers.ReadLine
       Response.Write "<a href='http://www.website.com/testing.asp?section=testing&ID=" & strNumber & "'>" & strNumber & "</a><br>" & vbCrLf
    Loop
    
    objWebNumbers.Close
    Set objWebNumbers = Nothing
    	
    Set connTextFile = Nothing
    %>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles