If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP method to check broken links

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-06-07, 07:34
JimFourleaf78 JimFourleaf78 is offline
Registered User
 
Join Date: Nov 2007
Posts: 11
ASP method to check broken links

Hi,

Does anybody know a way to check for broken links within ASP?
I want to be able to check web links across various servers.


I have used this code below and it works fine if the url is within the original domain that the code is run - however if I try another random website it will fail with

msxml3.dll error '800c0005'

The system cannot locate the resource specified.

/pages/links.asp, line 44



Function URLStatus(strURL)
Dim objXMLHTTP, strReturnStatus
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
'Set oXMLHttp=Server.CreateObject("MSXML2.XMLHTTP")


objXMLHTTP.Open "GET", "http://www.test.co.uk", False
objXMLHTTP.Send
strReturnStatus = objXMLHTTP.Status
Set objXMLHTTP = Nothing
URLStatus = strReturnStatus
End Function

Dim strfrmURL
strfrmURL = CStr("OK")
If strfrmURL <> "" Then
If URLStatus(strfrmURL) = "200" Then
Response.Write "Link is working."
Else
Response.Write "Link is not working: " & URLStatus(strfrmURL)
End If
End If
Reply With Quote
  #2 (permalink)  
Old 11-07-07, 08:02
SimonMT SimonMT is offline
Registered User
 
Join Date: Sep 2006
Posts: 265
The products I use and recommend is:

Xenu.

It works locally in pre-production or intranets and on your public website.

I have about 32,000 pages.

Locally takes about an hour on the website it can take 4 hours.

Simon
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On