Attributes, session management, weblogs and Google
I just had a faint memory of an e-mail by Clemens Vasters about a small set of .NET attributes for managing ASP.NET sessions. The idea was (now I know) to do something like this:
public class MyPage : StateManagingPage
{
[PersistentPageState] public int pageVisitsEver;
[PersistentPageState("Visits")] public int siteVisitsEver;
[SessionPageState] public int pageVisitsThisSession;
[SessionPageState("Visits")] public int siteVisitsThisSession;
[TransientPageState] public int roundtripsThisPage;
// omissions...
private void Page_Load(object sender, System.EventArgs e)
{
pageVisitsEver++;
siteVisitsEver++;
pageVisitsThisSession++;
siteVisitsThisSession++;
roundtripsThisPage++;
}
// omissions...
So there you go: use plain class fields to manage session (also page and application) state, a cool demo of .NET attributes versatility. But I didn't remember how it worked, let alone when it was... So of course I used a Google search ("clemens vasters session attribute") and was immediately taken to this entry in his weblog. Somebody should measure the impact on programmer's productivity of supposedly collateral things like google, weblogs and attributes.