Preferred Language:
Listing 24.36 - Global.asax
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
Application["SessionCount"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
Application.Lock();
int count = (int)Application["SessionCount"];
Application["SessionCount"] = count + 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
Application.Lock();
int count = (int)Application["SessionCount"];
Application["SessionCount"] = count - 1;
Application.UnLock();
}
//public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args)
//{
// // Get anonymous profile
// ProfileCommon anonProfile = Profile.GetProfile(args.AnonymousID);
// // Copy anonymous properties to authenticated
// foreach (SettingsProperty prop in ProfileBase.Properties)
// Profile[prop.Name] = anonProfile[prop.Name];
// // Kill the anonymous profile
// ProfileManager.DeleteProfile(args.AnonymousID);
// AnonymousIdentificationModule.ClearAnonymousIdentifier();
//}
//public void Profile_ProfileAutoSaving(object s, ProfileAutoSaveEventArgs e)
//{
// if (Profile.ShoppingCart.HasChanged)
// e.ContinueWithProfileAutoSave = true;
// else
// e.ContinueWithProfileAutoSave = false;
//}
</script>
Need ASP.NET and Visual Studio 2008 Training?
- Learn ASP.NET 3.5 from Stephen Walther, author of ASP.NET 3.5 Unleashed.
We've provided ASP.NET training for NASA, Lockheed Martin, the National Science Foundation, Verizon,
Boeing, the US House of Representatives, Kaiser, Petco, Mary Kay, and Microsoft.
Why not your company?
-
Receive a four day, hands-on, intensive workshop.
-
We fly to you, anywhere in the world.
-
We can bring our own laptops.
To learn more, visit the
Superexpert Training website.