473,769 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ 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 1803
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*******@disc ussions.microso ft.com> wrote in message
news:2F******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP15.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*******@disc ussions.microso ft.com> wrote in message
news:2F******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:2F******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP15.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*******@disc ussions.microso ft.com> wrote in message
news:2F******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:FA******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP15.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*******@disc ussions.microso ft.com> wrote in message
> news:2F******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:2F******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:FA******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP15.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*******@disc ussions.microso ft.com> wrote in message
> news:2F******** *************** ***********@mic rosoft.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
1543
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 misspelled a function name, or made some other silly mistake that a compiler would normally catch. Then I have to run it all over again to see what happened or come up with some sort of short test. I usually do try to isolate the new parts of...
13
2401
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 threading.Thread as the base class. Then I create objects of this class and call their start() methods in a loop. The program works fine when run locally in a shell. The problem starts
4
1252
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 limited knowledge or Regular Expressions. my code to check for the urls is: var test_url=/(www.url1.com)|(www.url2.com)|(history.go)/i;
22
4918
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 when working with large projects. It is *much* better to catch errors at "compile-time" rather than at run-time. One thing I've "found" is the PyChecker module (conveniently embedded in SPE), but it doesn't seem to do that great of a job. ...
0
1477
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 help ensure correct behavior in a concurrent environment. That's impressive. That's *really* impressive. I know of no other language that does that - though they probably exist. I'd be interested in references to them. Normally, I think of...
1
3074
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 is that this column should contain the table name for each insert, update, delete or select statement. Instead, I am seeing data that refers to the db name, the userid, a tablespace name etc. Further, it seems as if the ACCESSAPP and ACCESSATT...
5
1776
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 traverse through the array looking for the Process name. Is there a shortcut or easier way to accomplish this?
7
4139
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 project, so the client will automatically check if there is a newer version or not? haim
125
6605
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 problem. http://www.jilp.org/vol9/v9paper10.pdf Specifically, they measured the overhead of a bounds
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
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 we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.