示例#1
0
 private static RequestInfo CreateRequestInfo()
 {
     var requestInfo = new RequestInfo();
     requestInfo.Url = new Uri("http://medseek.com/home.aspx");
     requestInfo.SessionId = new string('x', 10);
     requestInfo.VisitorIdentifier = Guid.NewGuid();
     return requestInfo;
 }
示例#2
0
 private static RequestInfo CreateRequestInfo()
 {
     var requestInfo = new RequestInfo();
     requestInfo.SessionId = new string('x', 10);
     requestInfo.VisitorIdentifier = Guid.NewGuid();
     requestInfo.IPAddress = "127.0.0.1";
     requestInfo.UrlReferrer = new Uri("http://www.google.com");
     requestInfo.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11";
     return requestInfo;
 }
示例#3
0
 /// <summary>
 /// Finds the or create visit.
 /// </summary>
 /// <param name="requestInfo">The request info.</param>
 /// <returns></returns>
 public Visit FindOrCreateVisit(RequestInfo requestInfo)
 {
     if (requestInfo == null)
     {
         throw new ArgumentNullException("requestInfo");
     }
     var visit = Visits
         .OrderByDescending(v => v.Id)
         .FirstOrDefault(v => v.SessionId == requestInfo.SessionId);
     if (visit == null)
     {
         visit = new Visit(this, requestInfo);
         this.Visits.Add(visit);
     }
     return visit;
 }
示例#4
0
 public Visit(Visitor visitor, RequestInfo requestInfo)
     : this()
 {
     if (visitor == null)
     {
         throw new ArgumentNullException("visitor");
     }
     if (requestInfo == null)
     {
         throw new ArgumentNullException("requestInfo");
     }
     Visitor = visitor;
     SessionId = requestInfo.SessionId;
     IPAddress = requestInfo.IPAddress ?? string.Empty;
     UserAgent = requestInfo.UserAgent ?? string.Empty;
     if (requestInfo.UrlReferrer != null)
     {
         UrlReferrer = requestInfo.UrlReferrer.ToString();
     }
 }