1
Vote

Site statistics section.

description

Simple statistics control ported from ScrewTurnWiki (http://www.screwturn.eu/Statistics.ashx) BasicStatsPlugin.
Implemented as EasyControl.
Changes in Default.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ...
        ...
        string virtualPath = Request.Url.ToString();
        if (!String.IsNullOrEmpty(_page.VirtualPath) && _page.VirtualPath.Contains("~/"))
            virtualPath =
                _page.VirtualPath.Replace("~", String.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Host));
 
        SiteStatistics.GetInstance().WriteHit(HttpContext.Current,
                                              virtualPath);
    }
}
Changes in Web.Config:
<configSections>
...
<section name="StatsConfig" type="MyWebPagesStarterKit.Statistics.Config.StatisticsConfigSection" requirePermission="false"/>
</configSections>
...
...
<StatsConfig maxSessions="100" publicAccess="false" nobots="true" maxLanguages="5"/>

file attachments

comments

nadhavs wrote Mar 18, 2008 at 6:20 AM

sir,
  1. The following code in web config file where we have to write? please give me brief details. other wise it show errors.
<StatsConfig maxSessions="100" publicAccess="false" nobots="true" maxLanguages="5"/>
  1. Line 52: {
    Line 53: if (!SiteStatistics.GetInstance().PublicAccess && !Admin)
    Line 54: return string.Format("<h1 align=\"center\">{0}</h1>", StatisticsRes.stat_AccessDenied);
    Line 55:
    Line 56: if (_sessions == null || _sessions.Count == 0)
in the App_Code\Controls\StatisticsControl.cs

StepanLameroff wrote Mar 18, 2008 at 8:08 AM

Please see attachment file (from beta 1.2)

net4u wrote Mar 18, 2008 at 9:39 AM

I have the same errors.

net4u wrote Mar 18, 2008 at 10:16 AM

I surpassed the errors, but how to use? I don't have a section related to this ()

StepanLameroff wrote Mar 18, 2008 at 1:01 PM

net4u,
Statistics implemented as an EasyControl.
How to use:
You can add an 'EasyControl' section to any page.
While the section is in edit mode you can choose the 'Statistics.ascx' control from the drop down list.

rickardmagnusson wrote Mar 19, 2008 at 7:55 PM

It seams like this error i generated by a missing enum. StatisticsRes.stat_AccessDenied look's to me as a enum since it not have any reference to StatisticsRes in the file.