?
Solved

asp script to check and report broken links

Posted on 2003-03-25
7
Medium Priority
?
418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

801 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