473,473 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checking web site is running or not.

hello all,

I want to know how can I check whether a web site us running or not. I have
used HttpWebRequest but when I give a web site address, It takes few number
of seconds to throw exception if the web site is not running. Is there any
easy method of doing the same. I do *not* want to use IP to ping and check
the server.

Thanks
pradeep_tp
Feb 9 '06 #1
7 1780
I'm not sure it is logical or not,
but if you use HttpWebRequest and you get no error when web site is running,
so you can use a try catch block:

Dim isRunning As Boolean = True
Try
'your code
Catch ex As Exception
If ex.Message = "The error message you get" Then isRunning = False
End Try

Sorry if I misunderstood your problem.

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
hello all,

I want to know how can I check whether a web site us running or not. I
have
used HttpWebRequest but when I give a web site address, It takes few
number
of seconds to throw exception if the web site is not running. Is there any
easy method of doing the same. I do *not* want to use IP to ping and check
the server.

Thanks
pradeep_tp

Feb 9 '06 #2
I think his problem was that he did not want to wait the few second for the
timeout to happen.

I doubt you can ping the website and get an instant response, if that was
the case than all browsers would return a DNS immediately instead of
continually waiting for a response.

And yes, you cannot rely on ping either because ping checks to see if the
machine if running, not if IIS is running.

Is there a specific reason you feel you cannot wait until a timeout happens?

"Saber" <saber[.AT.]oxin.ir> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...
I'm not sure it is logical or not,
but if you use HttpWebRequest and you get no error when web site is
running,
so you can use a try catch block:

Dim isRunning As Boolean = True
Try
'your code
Catch ex As Exception
If ex.Message = "The error message you get" Then isRunning = False
End Try

Sorry if I misunderstood your problem.

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
hello all,

I want to know how can I check whether a web site us running or not. I
have
used HttpWebRequest but when I give a web site address, It takes few
number
of seconds to throw exception if the web site is not running. Is there
any
easy method of doing the same. I do *not* want to use IP to ping and
check
the server.

Thanks
pradeep_tp


Feb 9 '06 #3
If you can make an assumption that its running on port 80, then telnet into
port 80. If nothings listenting to the port, then the webservers not
running. The response should be pretty instant.

TELNET www.csua.berkeley.edu PORT=80

Lots of telnet examples in c# here

http://www.google.co.uk/search?hl=en...e+Search&meta=

--
Regards

John Timney
Microsoft MVP

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
hello all,

I want to know how can I check whether a web site us running or not. I
have
used HttpWebRequest but when I give a web site address, It takes few
number
of seconds to throw exception if the web site is not running. Is there any
easy method of doing the same. I do *not* want to use IP to ping and check
the server.

Thanks
pradeep_tp

Feb 9 '06 #4
Hi all,

Peter: I am using a timer inside a web serive. This timer will keep checking
5 websites whether they are running or not. I find that using HttpWebRequest,
if I request a web site which is down, it takes more than 15 seconds to
return me the error. The only reason I cannot wait for this much amount of
time is because I am using timer. I have 4 web sites and 1 ISAPI application
that I need to keep checking whether they are running.

John: Your suggestions is good. I suppose this will be useful when I only
need to check whether the IIS is runnig or not. What will happen if the IIS
is running fine and only one of the web sites is stopped. Is there any way to
check easily whether that particular web site is working fine.

Thanks.
pradeep_tp
"Peter Rilling" wrote:
I think his problem was that he did not want to wait the few second for the
timeout to happen.

I doubt you can ping the website and get an instant response, if that was
the case than all browsers would return a DNS immediately instead of
continually waiting for a response.

And yes, you cannot rely on ping either because ping checks to see if the
machine if running, not if IIS is running.

Is there a specific reason you feel you cannot wait until a timeout happens?

"Saber" <saber[.AT.]oxin.ir> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...
I'm not sure it is logical or not,
but if you use HttpWebRequest and you get no error when web site is
running,
so you can use a try catch block:

Dim isRunning As Boolean = True
Try
'your code
Catch ex As Exception
If ex.Message = "The error message you get" Then isRunning = False
End Try

Sorry if I misunderstood your problem.

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
hello all,

I want to know how can I check whether a web site us running or not. I
have
used HttpWebRequest but when I give a web site address, It takes few
number
of seconds to throw exception if the web site is not running. Is there
any
easy method of doing the same. I do *not* want to use IP to ping and
check
the server.

Thanks
pradeep_tp



Feb 10 '06 #5
You would first connect to the server on port 80 using telnet, then make a
GET request over telnet to the actual site. If it failed, your servers up
and your sites likely off.

Explanation of a telnet GET process here
http://www.dgate.org/~brg/bvtelnet80/

Of course you will need to confirm its actually faster than using the web
classes. I'm speculating that it will be much faster because its a much
lower level protocol than HTTP over TCPIP.

--
Regards

John Timney
Microsoft MVP

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
Hi all,

Peter: I am using a timer inside a web serive. This timer will keep
checking
5 websites whether they are running or not. I find that using
HttpWebRequest,
if I request a web site which is down, it takes more than 15 seconds to
return me the error. The only reason I cannot wait for this much amount
of
time is because I am using timer. I have 4 web sites and 1 ISAPI
application
that I need to keep checking whether they are running.

John: Your suggestions is good. I suppose this will be useful when I only
need to check whether the IIS is runnig or not. What will happen if the
IIS
is running fine and only one of the web sites is stopped. Is there any way
to
check easily whether that particular web site is working fine.

Thanks.
pradeep_tp
"Peter Rilling" wrote:
I think his problem was that he did not want to wait the few second for
the
timeout to happen.

I doubt you can ping the website and get an instant response, if that was
the case than all browsers would return a DNS immediately instead of
continually waiting for a response.

And yes, you cannot rely on ping either because ping checks to see if the
machine if running, not if IIS is running.

Is there a specific reason you feel you cannot wait until a timeout
happens?

"Saber" <saber[.AT.]oxin.ir> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...
> I'm not sure it is logical or not,
> but if you use HttpWebRequest and you get no error when web site is
> running,
> so you can use a try catch block:
>
> Dim isRunning As Boolean = True
> Try
> 'your code
> Catch ex As Exception
> If ex.Message = "The error message you get" Then isRunning = False
> End Try
>
> Sorry if I misunderstood your problem.
>
> "pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
> news:2F**********************************@microsof t.com...
>> hello all,
>>
>> I want to know how can I check whether a web site us running or not. I
>> have
>> used HttpWebRequest but when I give a web site address, It takes few
>> number
>> of seconds to throw exception if the web site is not running. Is there
>> any
>> easy method of doing the same. I do *not* want to use IP to ping and
>> check
>> the server.
>>
>> Thanks
>> pradeep_tp
>
>


Feb 10 '06 #6

but what will happen in a situation where, for eg. there are 5 web sites
runnon on the web server and only one web site is down which I want to check.
In this case if i telnet to port 80 it will give me the status that the web
site is up which is not true

"John Timney ( MVP )" wrote:
If you can make an assumption that its running on port 80, then telnet into
port 80. If nothings listenting to the port, then the webservers not
running. The response should be pretty instant.

TELNET www.csua.berkeley.edu PORT=80

Lots of telnet examples in c# here

http://www.google.co.uk/search?hl=en...e+Search&meta=

--
Regards

John Timney
Microsoft MVP

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
hello all,

I want to know how can I check whether a web site us running or not. I
have
used HttpWebRequest but when I give a web site address, It takes few
number
of seconds to throw exception if the web site is not running. Is there any
easy method of doing the same. I do *not* want to use IP to ping and check
the server.

Thanks
pradeep_tp


Feb 10 '06 #7

thanks john. I will try this out today. :)

"John Timney ( MVP )" wrote:
You would first connect to the server on port 80 using telnet, then make a
GET request over telnet to the actual site. If it failed, your servers up
and your sites likely off.

Explanation of a telnet GET process here
http://www.dgate.org/~brg/bvtelnet80/

Of course you will need to confirm its actually faster than using the web
classes. I'm speculating that it will be much faster because its a much
lower level protocol than HTTP over TCPIP.

--
Regards

John Timney
Microsoft MVP

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
Hi all,

Peter: I am using a timer inside a web serive. This timer will keep
checking
5 websites whether they are running or not. I find that using
HttpWebRequest,
if I request a web site which is down, it takes more than 15 seconds to
return me the error. The only reason I cannot wait for this much amount
of
time is because I am using timer. I have 4 web sites and 1 ISAPI
application
that I need to keep checking whether they are running.

John: Your suggestions is good. I suppose this will be useful when I only
need to check whether the IIS is runnig or not. What will happen if the
IIS
is running fine and only one of the web sites is stopped. Is there any way
to
check easily whether that particular web site is working fine.

Thanks.
pradeep_tp
"Peter Rilling" wrote:
I think his problem was that he did not want to wait the few second for
the
timeout to happen.

I doubt you can ping the website and get an instant response, if that was
the case than all browsers would return a DNS immediately instead of
continually waiting for a response.

And yes, you cannot rely on ping either because ping checks to see if the
machine if running, not if IIS is running.

Is there a specific reason you feel you cannot wait until a timeout
happens?

"Saber" <saber[.AT.]oxin.ir> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...
> I'm not sure it is logical or not,
> but if you use HttpWebRequest and you get no error when web site is
> running,
> so you can use a try catch block:
>
> Dim isRunning As Boolean = True
> Try
> 'your code
> Catch ex As Exception
> If ex.Message = "The error message you get" Then isRunning = False
> End Try
>
> Sorry if I misunderstood your problem.
>
> "pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
> news:2F**********************************@microsof t.com...
>> hello all,
>>
>> I want to know how can I check whether a web site us running or not. I
>> have
>> used HttpWebRequest but when I give a web site address, It takes few
>> number
>> of seconds to throw exception if the web site is not running. Is there
>> any
>> easy method of doing the same. I do *not* want to use IP to ping and
>> check
>> the server.
>>
>> Thanks
>> pradeep_tp
>
>


Feb 10 '06 #8

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

Similar topics

3
by: Moosebumps | last post by:
I'm wondering what kind of checking I can do on a python program before running it (besides reading over every line). I hate running a long python script, only to have it fail at the end because I...
13
by: Deepak Sarda | last post by:
Hello everyone. I have run into something which I believe is a bug or a shortcoming of the threading.Thread module. My program spawns 15 threads. For this I've creating a new class with...
4
by: bbcrock | last post by:
I want to check to see if the user uses the back button to exit our site. I want to stop running certain functions if they leave our site via a back button. I am a real newbie for JS and have a...
22
by: Qopit | last post by:
Hi there, I'm pretty new to Python and am trying to figure out how to get "will this code compile?"-like code checking. To me this is a pretty basic language/environment requirement, especially...
0
by: Mike Meyer | last post by:
The recent thread on threads caused me to reread the formal definition of SCOOP, and I noticed something I hadn't really impressed me the first time around: it's using staticly checkable rules to...
1
by: JS | last post by:
I have set up db2audit for checking on win2k v8 db, but when I extract the records from the log and load them into the checking table, I don't get the object name in objname colum. My understanding...
5
by: kd | last post by:
Hi All, If the name of a process is known, is it possible to check whether it is in execution? What I did was to fetch all the processes running on the system using Process.GetProcesses() and...
7
by: HIK | last post by:
Click once can be set up to pole the setup url if there is a newer version or not. I have a project which can only be deployed using a setup project. How can I create the same feature in my setup...
125
by: jacob navia | last post by:
We hear very often in this discussion group that bounds checking, or safety tests are too expensive to be used in C. Several researchers of UCSD have published an interesting paper about this...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.