Pulling content from a file


I am looking for some help. My company uses SharePoint 2007 as a CMS. We have a set of publishing sites. When servers go down, we would like to apply a status message. It doesn’t have to be automatically applied, just would appear on first load (if a message exists) or a subsequent refresh. Here’s how we would like it to work:

  • Status message is located in a text file on the server.

  • When a page loads, we would like each it to check to see if there is anything in the text file, and if so, display the message on the page.

  • If the text file is empty, we would like it not to display anything on the page.

I can think of a few different ways this could be accomplished using PHP or something, but I’m at a loss as how to do it within SharePoint. Any suggestions? Ideally we would be able to place such a block of code into the masterpage.

If you want to run a client-side script, you can use Javascript to make an HTTPRequest, with responseText to display the content of the file on your web page

I do not understand the point of the text file? Y not use a database or something like that? Or just do a HttpRequest to said servers and if it fails, the server is down. How you going to update a text file when the server goes down?

If you go this route, text file, just use the File System objects, read from the text-file, check it’s content length, if it’s empty, make a decision on what you want to do.

We’re a hosting company that has a bunch of servers. Basically, the text file was just an easy way for anyone to update the status. Say Server2 fails, we would want to broadcast that on our site so that customers coming to our site will know.