473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Link checker in ASP

Hi,

How can I check a link in ASP?

I need to verify the exact link, just as http://validator.w3.org/checklink
performs the validation -
e.g.: if a user inserts http://www.exampleURL.com, i'd like to verify
whether it's
http://www.exampleURL.com OR
http://exampleURL.com OR
http://www.exampleURL.com/home.asp

How can I do it?

Thanks, Gabi

Oct 13 '07 #1
6 2403
Gabriella wrote on 13 okt 2007 in
microsoft.public.inetserver.asp.general:
I need to verify the exact link, just as
http://validator.w3.org/checklink performs the validation -
e.g.: if a user inserts http://www.exampleURL.com, i'd like to verify
whether it's
http://www.exampleURL.com OR
http://exampleURL.com OR
http://www.exampleURL.com/home.asp
All three could be valid, and some could be out temporarily.

Server.XMLhttp requesing the headers for a status = 200 answer should do
the trick.

<http://classicasp.aspfaq.com/general...contents-of-a-
remote-web-page.html>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 13 '07 #2
Hi,
I understand that all three URLs are possible, but I want to know
WHICH ONE is being used by the webserver.
If you look at http://www.rsizr.com you will see they redirect you to
http://rsizr.com - that's what I'd like to know!
That's what http://validator.w3.org/checklink gives you.
Server.XMLhttpRequest only tells you, according to the status number,
whether this URL is broken or valid. Not good enough.
I need to know which exact URL is being used.

Thanks, Gabi.

Oct 14 '07 #3
"Gabriella" <fr********@yahoo.comwrote in message
news:11**********************@k35g2000prh.googlegr oups.com...
Hi,
I understand that all three URLs are possible, but I want to know
WHICH ONE is being used by the webserver.
If you look at http://www.rsizr.com you will see they redirect you to
http://rsizr.com - that's what I'd like to know!
That's what http://validator.w3.org/checklink gives you.
Server.XMLhttpRequest only tells you, according to the status number,
whether this URL is broken or valid. Not good enough.
I need to know which exact URL is being used.
I'm not sure what Server.XMLhttpRequest is but I'll assume we are actually
talking about MSXML2.ServerXMLHTTP.3.0.

The site you give as an example is responding with a 301 Moved Permanetly
status and carries the header Location: http://rsizr.com.

ServerXMLHTTP will internally follow this redirection and will return
normally with a 200 response. The problem is that there is no way to
determine the final URL used internally to complete the request with MSXML3.
MSXML6 does provide an option to discover this.

The best and most compatible way is to use the underlying WinHTTP component
which on Win2000 SP2 or higher is present without additional installs:-

Function FinalURL(rsURL)

Dim oWinHTTP
Const WinHttpRequestOption_URL = 1

Set oWinHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

oWinHTTP.Open "HEAD", rsURL, False
oWinHTTP.Send

FinalURL = oWinHttp.Option(WinHttpRequestOption_URL)

End Function

sFinalURL = FinalURL("http://www.rsizr.com/")

You should note however that some sites still rely on HTML meta tags to
proform a similar function. In those cases this technique isn't going to
help.
--
Anthony Jones - MVP ASP/ASP.NET
Oct 14 '07 #4
Thanks Anthony, I've tried it and I get the following error:
"A connection with the server could not be established" right after
calling FinalURL method in line:
sFinalURL = FinalURL("http://www.rsizr.com/")
the error is displayed will every URL I try...
Any ideas why?
Gabi.

Oct 15 '07 #5
"Gabriella" <fr********@yahoo.comwrote in message
news:11*********************@q3g2000prf.googlegrou ps.com...
Thanks Anthony, I've tried it and I get the following error:
"A connection with the server could not be established" right after
calling FinalURL method in line:
sFinalURL = FinalURL("http://www.rsizr.com/")
the error is displayed will every URL I try...
Any ideas why?
If you logon to the server as an interactive session can you access the site
using IE?
If so, in IE internet settings is a proxy server configured?
--
Anthony Jones - MVP ASP/ASP.NET
Oct 15 '07 #6
Hi, I tried it on shared hosting web server, and it seems like they
blocked the methods
oWinHTTP.Open "HEAD", rsURL, False
oWinHTTP.Send
also using the same methods on MSXML2.ServerXMLHTTP.3.0. returns the
same error.
On the other hand, when trying it on my private web server - it works!
So THANKS!

Oct 16 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: work4u | last post by:
Hello Everyone, I am coding the reciprocal link exchange form which there is function to check if my site info and link already been add on the partner site page or not. Please anyone who works...
6
by: saqib ali | last post by:
Hello All, I manage a rather large website, that has several hundred content managers. These content managers can create links at their will. I want to take a look a list of all the Links that...
47
by: Andy Dingley | last post by:
Assume an English language page, linking to a foreign history resource that's only available in a foreign language. Any suggestions on appropriate "best practice" markup, particularly regarding the...
7
by: Hank Reed | last post by:
I am trying to use the spell checker on an unbound control in Access 2000. I run the checker in the AfterUpdate event of the control. After the spell checker is done, I get the following message:...
8
by: Joe | last post by:
Hello All: Does anyone know of a spell checker that works with .NET? Any options will be welcome. TIA, -- Joe
8
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided...
8
by: Steve | last post by:
Hi Guys; You have been giving me a lot of useful information in the other two threads. Thanks! Very interesting. Here is my situation. My friend is writing a book. He has 3100 citations,...
0
by: durumdara | last post by:
Hi ! Sorry for non-pythonic subject, but if I not find good solution, I will write a routine for this in python... :-))) My mod_py site is growing quickly. It have many pages, many of them...
13
by: kolmogolov | last post by:
/* Hi, I have removed things irrelevant to reproducing the problem. What's wrong with my code? Thanks in advance for any hint! 1166425362 */ #include <stdio.h> #include <stdlib.h> #include...
6
by: Neil | last post by:
Is there way to have control over the MS-Access spell checking (besides just launching it)? We want to tell it to check all records, but skip certain fields (or, alternatively, ONLY check certain...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.