public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { if ((this.Filter == null) || this.Filter.ShouldTrace(eventCache, source, eventType, id, null, null, data, null)) { if (data is LogEntry) { LogEntry MsgEntry = data as LogEntry; BrowseTrace bt = new BrowseTrace(); bt.SessionID = MsgEntry.ExtendedProperties["SessionId"].ToString(); bt.UserID = Guid.Parse(MsgEntry.ExtendedProperties["UserId"].ToString()); bt.EnterTime = DateTime.Now; bt.PreviousUrl = MsgEntry.ExtendedProperties["PreviousUrl"].ToString(); bt.NowUrl = MsgEntry.ExtendedProperties["NowUrl"].ToString(); bt.Save(); } else if (data is string) { Write(data as string); } else { base.TraceData(eventCache, source, eventType, id, data); } } }
public void Write(string sessionId, Guid userId, string message) { BrowseTrace bt = new BrowseTrace(); bt.SessionID = sessionId; bt.UserID = userId; }