Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I let the server know the web app is running and active??

How do I let the server know the web app is running and active??

Scheduled Pinned Locked Moved ASP.NET
questionsysadmintutorial
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IrishSonic
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • I IrishSonic

      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

      A Offline
      A Offline
      Andrew Quinn AUS
      wrote on last edited by
      #2

      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

      I 1 Reply Last reply
      0
      • A Andrew Quinn AUS

        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

        I Offline
        I Offline
        IrishSonic
        wrote on last edited by
        #3

        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.

        I 1 Reply Last reply
        0
        • I IrishSonic

          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.

          I Offline
          I Offline
          IrishSonic
          wrote on last edited by
          #4

          Sorry, one last question. I am creating a log on/off web app. How do I close all open web forms??

          A 1 Reply Last reply
          0
          • I IrishSonic

            Sorry, one last question. I am creating a log on/off web app. How do I close all open web forms??

            A Offline
            A Offline
            Andrew Quinn AUS
            wrote on last edited by
            #5

            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

            I 1 Reply Last reply
            0
            • A Andrew Quinn AUS

              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

              I Offline
              I Offline
              IrishSonic
              wrote on last edited by
              #6

              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??

              A 1 Reply Last reply
              0
              • I IrishSonic

                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??

                A Offline
                A Offline
                Andrew Quinn AUS
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups