How do I let the server know the web app is running and active??
-
Hiya I need to send a server a heart-beat message from a web app every few seconds to tell the server that the web app is active and running?? Does anyone have any ideas how to do this?? Thanks
-
Hiya I need to send a server a heart-beat message from a web app every few seconds to tell the server that the web app is active and running?? Does anyone have any ideas how to do this?? Thanks
Hi there, Web servers respond to requests so why not use this as the "heartbeat", that is, instead of the web app calling out why don't you get the server to call in (by a time interval configured). What is the "server" written in? .NET? VC++? VB? Java? If the server is on a MS Platform (and isn't .NET) then you can use the old-world ServerXMLHTTP COM object, e.g. PSUEDO-CODE
var objSend = new ActiveXObject("Microsoft.XMLHTTP"); try { strURL = "http://mywebserver/myapp/siteinfo.xml"; objSend.open("GET", strURL, false); objSend.send(); } catch(e) { }
You can have an XML file on the webserver - it doesn't have to be XML or even have any contents. The fact is that if the open executes without causing an exception then we have successfully contacted the web application, running on the mywebserver. You could even extend the idea, swap the static xml file for an aspx page and you could get ASP.NET to write diagnostic information back to the client (your server). If you wrote back XML then the client could load this into an XML Document and parse the diagnostic information, e.g.
var objSend = new ActiveXObject("Microsoft.XMLHTTP"); try { strURL = "http://mywebserver/myapp/siteinfo.aspx"; objSend.open("GET", strURL, false); objSend.send(); var objXML = new ActiveXObject("Msxml2.DOMDocument.4.0"); if (objXML) { objXML.async = false; objXML.loadXML(objSend.responseText); // we can now use XPATH to query the XML document and retrieve the info // ... // ... } } catch(e) { }
Hope this helps, Andy
-
Hi there, Web servers respond to requests so why not use this as the "heartbeat", that is, instead of the web app calling out why don't you get the server to call in (by a time interval configured). What is the "server" written in? .NET? VC++? VB? Java? If the server is on a MS Platform (and isn't .NET) then you can use the old-world ServerXMLHTTP COM object, e.g. PSUEDO-CODE
var objSend = new ActiveXObject("Microsoft.XMLHTTP"); try { strURL = "http://mywebserver/myapp/siteinfo.xml"; objSend.open("GET", strURL, false); objSend.send(); } catch(e) { }
You can have an XML file on the webserver - it doesn't have to be XML or even have any contents. The fact is that if the open executes without causing an exception then we have successfully contacted the web application, running on the mywebserver. You could even extend the idea, swap the static xml file for an aspx page and you could get ASP.NET to write diagnostic information back to the client (your server). If you wrote back XML then the client could load this into an XML Document and parse the diagnostic information, e.g.
var objSend = new ActiveXObject("Microsoft.XMLHTTP"); try { strURL = "http://mywebserver/myapp/siteinfo.aspx"; objSend.open("GET", strURL, false); objSend.send(); var objXML = new ActiveXObject("Msxml2.DOMDocument.4.0"); if (objXML) { objXML.async = false; objXML.loadXML(objSend.responseText); // we can now use XPATH to query the XML document and retrieve the info // ... // ... } } catch(e) { }
Hope this helps, Andy
Hiya Andy, thanks for that, has helped abit. The Server app is written in VB. New to asp.net so will try to understand what you mean.
-
Hiya Andy, thanks for that, has helped abit. The Server app is written in VB. New to asp.net so will try to understand what you mean.
Sorry, one last question. I am creating a log on/off web app. How do I close all open web forms??
-
Sorry, one last question. I am creating a log on/off web app. How do I close all open web forms??
Hi, Not sure what you mean. Are you talking about windows that you have opened from a form (via the client-side script using window.open). Or do you mean the web server closing all currently "connected" clients? Cheers, Andy
-
Hi, Not sure what you mean. Are you talking about windows that you have opened from a form (via the client-side script using window.open). Or do you mean the web server closing all currently "connected" clients? Cheers, Andy
Yeah sorry Andy, didn't explain myself very well. Nothing to do with web server or server app. I have a asp.net web app that contains many forms. In the web app, I have a frameset and a contents.htm file for my frameset. So on startup, the first screen they meet is the log on screen. So they log on and a new web form opens containing the frameset so they can browse between different web forms. Now I also have a log off screen, so when the user clicks "Log Off" button, in here I need to kill of the screens the user has opened and return them to the log on screen, incase a different user wants to log on. How do I do this??
-
Yeah sorry Andy, didn't explain myself very well. Nothing to do with web server or server app. I have a asp.net web app that contains many forms. In the web app, I have a frameset and a contents.htm file for my frameset. So on startup, the first screen they meet is the log on screen. So they log on and a new web form opens containing the frameset so they can browse between different web forms. Now I also have a log off screen, so when the user clicks "Log Off" button, in here I need to kill of the screens the user has opened and return them to the log on screen, incase a different user wants to log on. How do I do this??
Hi, And the button exists in a page in one of the frames? You can have client-side script that performs the following:
function onLogoff()
{
if (window.parent)
{
window.parent.location.href = "logoff.aspx";
}
}...
...
...
...Hope this helps, Andy