Author: saphua | Posted on: 7/16/2009 7:54:32 AM | Views : 593

Hello,
I am using LogParser and MSUtil to get the traffic of the current website; here's a chuck of the code:
private void UpdateByDateRange(DateTime dateFrom, DateTime dateTo) { string siteId = Request.ServerVariables["INSTANCE_ID"]; LogQueryClass logger = new LogQueryClassClass(); COMIISW3CInputContextClass inputContext = new COMIISW3CInputContextClassClass(); string query = "SELECT SUM(TO_REAL(sc-bytes)) AS sentTotal, SUM(TO_REAL(cs-bytes)) AS receivedTotal FROM <" + siteId + "> WHERE TO_TIMESTAMP(date, time) >= TO_TIMESTAMP('" + dateFrom.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss') AND TO_TIMESTAMP(date, time) <= TO_TIMESTAMP('" + dateTo.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-MM-dd HH:mm:ss')"; ILogRecord record = logger.Execute(query, inputContext).getRecord(); decima ...

Go to the complete details ...