I am trying to find number of visitors for a site using Application.
My Global.asax.cs looks like this:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//Added for version tracking
Application["ActiveUsers"] = 0;
}
And my Controller I added following code:
string i = Application["ActiveUsers"].ToString();
But I am getting a error "Application' does not exist in the current context" .
Am I missing any namespace or is Application doesn't work in Controller level.(I don't see error in Golbal.asax.cs)
Thanks.
You can access that via: