application background: As a webmaster, in order to manage the site, and to please the search engines every day at different times need to update the site, some owners need to maintain several Web sites, the daily workload One can imagine that if the holidays, the owners do not or can not access the computer side,
Office 2010 Download, the maintenance work will not proceed. use of Principle: This article describes a way to automatically update website content, using a Windows system service, set its URL to access the address, within a specific time each day to update the contents of the site visit to a special page (assuming that page is A); on the site side,
Windows 7 Enterprise, set up a screening mechanism, and only approved content to be displayed on the website front end, the new Canadian information is not audited by default, page A role is never singled out a few review audit information , so that updated content, the static home page, the page can also generate the next page A static page. A page of course, can do more uses, such as backup database, change the user status expires, delete unused temporary files. detailed principles: 1) Windows server: Windows Service using. Net Framework2.0 framework, it should be installed using the good. Net Framework2.0, Download:xml file using a stored configuration information, which need to access the web site storage, the sample structure is as follows: an item on behalf of a visit, url is a specific site, set to automatically update the url website address, you can update with a query string to set the amount, time access time that day, time can only be accurate to 1 minute and must ensure that every item in the same minute, only a url tasks. program uses a timer, every 20 seconds to scan the configuration item in the need to access the site, if there is one visit the site. Relevant code is as follows: public Job () { System.Timers.Timer myTimer = new System.Timers.Timer (20000); myTimer.Elapsed + = new ElapsedEventHandler (myTimer_Elapsed); myTimer.Enabled = true; myTimer.AutoReset = true; XmlDocument xml = new XmlDocument (); xml.Load (AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings [xmlfile ]); xmllist = xml.SelectNodes (/ / root / Urls / item); } void myTimer_Elapsed (object source, ElapsedEventArgs e) { try { Log.SaveNote (DateTime.Now.ToString (yyyy-MM-dd HH: mm: ss) + Heart Work,
Office Enterprise 2007 Key! (heartbeat detection )); YourTask ();} catch (Exception ee) { Log.SaveException (ee); } } void YourTask () { count ++; if (count> 10000) count = 0; for (int i = 0; i <xmllist.Count; i ++) { string url = xmllist [i]. Attributes [url]. Value; string time = xmllist [i]. Attributes [time]. Value; / / Log.SaveNote (url + - + time); DateTime workTime = DateTime.Parse (DateTime.Now.ToShortDateString () + + time); / / lastwork if (DateUtil.DateDiff (DateUtil.DateInterval.Minute, workTime, DateTime.Now) == 0) { / / to the execution time if (DateUtil.DateDiff (DateUtil.DateInterval.Minute, workTime, lastworktime)! = 0) { / / access the web site, such as mobile themes visit (url); lastworktime = DateTime.Now; } } } } void visit (string url) { HttpWebRequest myHttpWebRequest = null; HttpWebResponse myHttpWebResponse = null; Stream receiveStream = null; try { myHttpWebRequest = (HttpWebRequest) WebRequest.Create (url); myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse (); receiveStream = myHttpWebResponse.GetResponseStream ();// get back to writing the byte stream Log.SaveNote (visit: + url); } catch (Exception ex) { Log.SaveNote (access failed: + url); Log.SaveException (ex); } finally { if (receiveStream! = null) receiveStream.Close (); if (myHttpWebResponse! = null) myHttpWebResponse.Close ();} } 2) Web-side: site audit client should use mechanisms, such as a table News tables,
Microsoft Office Enterprise 2007, set field isaccept to review the field, one that has been audited, unaudited 0, add the contents of the default is not reviewed 0. More than in peacetime, when we add some content to the library is not reviewed, and then to the program to automatically update. Update to use any dynamic web page technology, asp, php,
Microsoft Office 2010 Home And Stude/nt, jsp can be, the role of the program is to change not reviewed the contents of the audit status, for the sake of flexibility, you can set a query string that update the number of variables to the program, If num, the website is updated 3 becomes