Want to show off how long your .Text web server has been up and running (time since the last machine reboot) on your .Text header (in the blog stats section)? Here’s how:
- Add the following code to your [skin name]\Controls\BlogStats.ascx file: [asp:Literal ID="SystemUptime" Runat = "server" /] (use wickets instead of brackets of course).
- To your DotText.Framework\Data\DataHelper.cs file:
using
System.Diagnostics;
public static BlogConfig LoadConfigData(IDataReader reader)
{...
PerformanceCounter pc = new PerformanceCounter("System",
"System Up Time");
pc.NextValue();
-
To your Dottext.Framework\Configuration\BlogConfig.cs file:
private TimeSpan _systemUptime;
public TimeSpan SystemUptime
{
get {return this._systemUptime;}
set {this._systemUptime = value;}
}
It’s that easy. Just compile, copy over the new assemblies (and the BlogStats.ascx file) and you’re good to go. For any rss subscribers, visit my blog to see how it looks (upper right-hand corner).
Posted
Mar 26 2005, 12:34 AM
by
Jayson Knight