?
Solved

asp script to check and report broken links

Posted on 2003-03-25
7
Medium Priority
?
432 Views
Last Modified: 2008-02-01
hi,

i need to create a asp script to check and report broken links.
i have a page whereby it contains 1000 urls from a database and then its lame to check every single one of them manually....so i need to create a page to check for any broken links and then stored the url into a text file
0
Comment
Question by:huang_juxiang
7 Comments
 
LVL 7

Expert Comment

by:markhoy
ID: 8201610
see www.hotscripts.com or www.planet-source-code.com and use one of their scripts.
0
 

Author Comment

by:huang_juxiang
ID: 8201628
i been there...they dun have asp script...they only have perl or php...i dunno how to run them
0
 
LVL 3

Expert Comment

by:JagC
ID: 8201662
The only way I can think of doing it is to have a page that iterates through the links in the database and uses something like ASPTear to go to the page and search for known strings such as "HTTP 404 - File not found".

ASPTear can be found at: http://www.alphasierrapapa.com/IisDev/Components/AspTear/

It's free, but you need to be able to install components on your server.

Hope this helps.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Accepted Solution

by:
markhoy earned 80 total points
ID: 8201852
0
 

Author Comment

by:huang_juxiang
ID: 8207335
i have a sample script but the thing is that i don't tink that the script is working coz i have a broken link within the database but they still return postive to me (postive = working, negative = not working), however when i try the url http:// with nothing...it returns me negative....
can any1 pls help me to look at this script and highlight to me how can i solve this prob....
example of my broken link: http://www.nyp.edu.sg/as/studdev/c_sd07.htm

==========================================================
the script: url.asp
==========================================================
<% @Language="VBScript" %>
<% Option Explicit
Response.Buffer = True
On Error Resume Next
'==========================================================================='
' This ASP (Active Server Pages) program does the following:
' 1) Reads URLs from a database;
' 2) Uses "XMLHTTP" to validate each prepending "http://"; if necessary;
' 3) Lists each URL with a "+" (found) or "-" (not found) prefix.

Const cASP = "URL.asp"
Const cMDB = "Links.mdb"

Dim strDSN
strDSN = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(cMDB)
Dim strERR
Dim strSQL
strSQL = "SELECT URL FROM Links order by group"
Dim strURL
Dim strXML

Dim objADO
Dim objRST
Dim objXML
Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
'Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")

Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open strDSN

Set objRST = Server.CreateObject("ADODB.Recordset")
objRST.Open strSQL, objADO

Do While Not objRST.EOF
     strURL = objRST("URL")

     If Left(LCase(strURL),7) <> "http://" Then
          strURL = "http://" & strURL
     End If

     objXML.Open "GET", strURL, False
     objXML.Send

     If Err.Number = 0 Then
          'strXML = "<xmp>" & objXML.ResponseText & "</xmp>"
          strERR = "+"
     Else
          strERR = "-"
     End If

     Response.Write "<br>" & strERR & "   " & objRST("URL")
     Response.Flush
     Err.Clear
     objRST.MoveNext
Loop

objRST.Close
Set objRST = Nothing

objADO.Close
Set objADO = Nothing
Set objXML = Nothing
%>
0
 

Author Comment

by:huang_juxiang
ID: 8207344
hi markhoy,

in planet-source-code and hotscripts, which category should i go to.....if i serach they return other scripts rather than asp.....
0
 
LVL 58

Expert Comment

by:Gary
ID: 9312920
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by markhoy

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question