paulwhelan
asked on
Auto insert and check if website is live?
Hi
I know that I can check if a website is 'live' by doing this in C#
HttpWebRequest webRequest = (HttpWebRequest)WebRequest .Create(we bsiteToReq uest);
webRequest.Timeout = 6000;
HttpWebResponse webResponse = (HttpWebResponse)webReques t.GetRespo nse();
string responseStream = webResponse.GetResponseHea der("Conte nt-Length" );
But does anyone know how to set up a scheduled task to check if a site is 'live'
and then insert into a table in my sql server database to say if its live or not?
Thanks
I know that I can check if a website is 'live' by doing this in C#
HttpWebRequest webRequest = (HttpWebRequest)WebRequest
webRequest.Timeout = 6000;
HttpWebResponse webResponse = (HttpWebResponse)webReques
string responseStream = webResponse.GetResponseHea
But does anyone know how to set up a scheduled task to check if a site is 'live'
and then insert into a table in my sql server database to say if its live or not?
Thanks
ASKER
BTW I just tried saving this
strConnection = "Data Source=PC024\\PAUL;Initial Catalog=paulstest;Integrat ed Security=True;";
set objConn = CreateObject("ADODB.Connec tion")
objConn.Open strConnection
Set objRS = CreateObject("ADODB.Record set")
SQL = "INSERT INTO websitestatistics(id, checkeddate, didreply) " & _
"VALUES ('1', '" & NOW() & "', 'n')"
set objRS = objConn.execute(SQL)
to a file 'scheduled.vbs'
and added a scheduled task
but when it ran it threw an error
windows script host
expected end of statement
strConnection = "Data Source=PC024\\PAUL;Initial
set objConn = CreateObject("ADODB.Connec
objConn.Open strConnection
Set objRS = CreateObject("ADODB.Record
SQL = "INSERT INTO websitestatistics(id, checkeddate, didreply) " & _
"VALUES ('1', '" & NOW() & "', 'n')"
set objRS = objConn.execute(SQL)
to a file 'scheduled.vbs'
and added a scheduled task
but when it ran it threw an error
windows script host
expected end of statement
ASKER
"Well you could compile that code and execute it as a SQL Job...
Change your code to add a SQL Server connection string and insert the results into SQL."
How would I do that?
Thanks
Change your code to add a SQL Server connection string and insert the results into SQL."
How would I do that?
Thanks
ASKER
ok I see it in Enetrprise Manager
Tools
Job Scheduling
Is it possible to check if the site is live and then do an insert to the database with a visual basic script?
If so how?
Thanks
Tools
Job Scheduling
Is it possible to check if the site is live and then do an insert to the database with a visual basic script?
If so how?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Change your code to add a SQL Server connection string and insert the results into SQL.