the way I do it is to make custom page.
That connects to database, checks hard-drive space,.....
Basically does everything that needs to be checked. And outputs it as HTML.
Something like
Empty Space:1Gb<br>
Database: OK
Then your code simply displays it.
So you have for example
<%=checkURL("
http://google.com/test.aspx")%>
And your checkURL will do folowing (pseducode, do not know VB well)
Function CheckUrl(sUrl) as String
Dim req As Net.HttpWebRequest
Dim res As Net.HttpWebResponse
Dim str As IO.Stream
Try
req = Net.WebRequest.Create("sUrl")
res = req.GetResponse()
str = res.GetResponseStream()
Return New IO.StreamReader(str).ReadToEnd()
Catch ex As WebException
ex.Response.Dispose()
Return "Connected to server but got an error: " & ex.Message
Catch e As Exception
Return "Could not connect to server: " & e.Message
Finally
if( str Not Is Nothing) Then str.Dispose()
if( res Not Is Nothing) Then res.Dispose()
End Try
End Function
PS: Do not forget to properly close Dispose objectes. You will run out of
resources soon otherwise.
But it only works if you can create your custom test.aspx page on the
server.
If not, you are limmited to was able to connect to server/was not able
to.....
George.
[quoted text, click to view] "darrel" <notreal@nowhere.com> wrote in message
news:ue$MhtjqIHA.1736@TK2MSFTNGP04.phx.gbl...
> >I hope you changed this line
>> Dim req As Net.HttpWebRequest = Net.WebRequest.Create("your url")
>> "your url" suppose to be whatever you passing to checkURL
>
> You have my permission to walk over here and smack me upside the head for
> such a stupid mistake! ;o)
>
> I am completely embarrassed by that one. ;o)
>
> OK, so, that works! Now, to followup...
>
> That returns the actual page. What I need to do is check for specific
> errors. For instance, if it can't access the page at all, I get a "Unable
> to connect to the remote server".
>
> Is there a master list of these types of errors out there to reference
> against?
>
> Or, in general, is this even a good way to go about testing for the status
> of a server?
>
> -Darrel
>