Testing Live Writer.
1: public class ActivityModule : IHttpModule
2: {
3: #region IHttpModule Members
4:
5: public void Dispose()
6: {
7: _application.AuthorizeRequest -= new EventHandler(_application_AuthorizeRequest);
8: _application = null;
9: }
10:
11: HttpApplication _application = null;
12:
13: public void Init(HttpApplication context)
14: {
15: _application = context;
16: _application.AuthorizeRequest += new EventHandler(_application_AuthorizeRequest);
17: }
18:
19: void _application_AuthorizeRequest(object sender, EventArgs e)
20: {
21: if (_application.Context.User.Identity.IsAuthenticated)
22: {
23: string username = _application.Context.User.Identity.Name;
24: MagInfoDataContext db = new MagInfoDataContext();
25: User user = (User)(from u in db.Users where u.Username == username select u).FirstOrDefault();
26: if (user != null)
27: {
28: user.LastAction = DateTime.Now;
29: db.SubmitChanges();
30: }
31: }
32: }
33:
34: #endregion
35: }