Design question regarding Web Site Monitoring

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a VB.NET code that I can use to monitor an independent Web
Site, I would like to do an equivalent of a PING of the site every 5 minutes
or so and make sure that it returns the appropriate login is screen. I then
will use the response to send an email if the site is not responding properly.

I would think that somewhere on the Web this code exists but I could not
find it. Can someone point me to such a site?
 
Conversion was easy using:
http://authors.aspalliance.com/aldotnet/examples/translate.aspx

This solution executes PING and gives the standard PING response. Actually,
I want to hit the site with a string such as google.com then read sufficient
information from the return so that I can verify that the correct page is
being displayed. For example, I want to verify that the return page contains
"Please enter your login ID"

I modified your code slightly but when I execute it, it only opens the Web
site and does not return anything to p.StandardOutput.

Here is the code that I used:

Dim p As New Process
Dim pi As New ProcessStartInfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = "www.google.com"
pi.FileName = "C:\Program Files\Internet Explorer\iexplore.exe"
p.StartInfo = pi
p.Start()
Dim sr As System.IO.StreamReader = p.StandardOutput
Dim s As String = sr.ReadToEnd
MsgBox(s)
 
Joe,
I modified your code slightly but when I execute it, it only opens the Web
site and does not return anything to p.StandardOutput.
Because that I gave you the wrong one.

:-)

You know how to translate you said.

\\\
Process p = new Process();
ProcessStartInfo pi = new ProcessStartInfo();
pi.UseShellExecute = false;
pi.RedirectStandardOutput = true;
pi.Arguments = "www.google.com";
pi.WorkingDirectory = "C:\\windows\\system32";
//this for nt* computers
pi.FileName = "ping";
p.StartInfo = pi;
p.Start();
System.IO.StreamReader sr = p.StandardOutput;
System.Text.StringBuilder sb = new System.Text.StringBuilder("");
int input = sr.Read();
while (input != -1)
{
sb.Append((char) input);
input = sr.Read();
}
MessageBox.Show(sb.ToString());
///

Sorry

Cor
 
I had your code correctly translated to what you showed below.
Unfortunately, that is not what I want to happen. I do not want to execute
PING. Instead, I want to open the returning HTML code and search to see if
it contains "Please enter your login ID."

The code that I displayed was a modification of your code in an attempt to
accomplish this result.
 
Joe,

You can use axwebbrowser or Httprequest for that, there are tons of software
for what you ask on Internet. I have myself as well samples for that, you
can search for those in Google newsgroups. However they fit only a part of
your question. Raw HTML data is not easy to check using a program.

Cor
 
FYI; Here is the code that I found. Inspiration came from:
http://www.w3coder.com

Dim myHttpWebRequest As HttpWebRequest =
CType(WebRequest.Create("http://www.mangia.tzo.com/CMS"), HttpWebRequest)
Dim myHttpWebResponse As HttpWebResponse =
CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = myHttpWebResponse.GetResponseStream()
Dim encode As System.Text.Encoding =
System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(receiveStream, encode)
Dim s As String = readStream.ReadToEnd()
Dim i As Integer = InStr(s, "User Name:")

If i > 0 Then
C.MsgInfo("Site contains ""User Name""")
End If

readStream.Close()
myHttpWebResponse.Close()


:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top