我是 Sitecore 的新手。我正在尝试实现以下进程类来覆盖GeoIP值以进行测试。
我找不到类 Tracker 位于哪个命名空间中。请注意,我使用的是托管在 localhost 上的Sitecore 8 。Sitecore 博客:@sitecorejohn 博客
有人可以帮我解决这个命名空间问题吗?
谢谢。
namespace Sitecore.Sharedsource.Analytics.Pipelines.StartTracking
{
using System.Net;
using Sitecore.Analytics;
using Sitecore.Analytics.Pipelines.StartTracking;
public class OverrideIPAddress
{
public void Process(StartTrackingArgs args)
{
if (Tracker.CurrentVisit == null
|| Tracker.CurrentVisit.GeoIp == null
|| Tracker.CurrentVisit.Ip == null)
{
return;
}
string ip = new IPAddress(
Tracker.CurrentVisit.GeoIp.Ip).ToString();
if (ip != "0.0.0.0" && ip != "127.0.0.1")
{
return;
}
string html = Sitecore.Web.WebUtil.ExecuteWebPage(
"http://www.whatismyip.com/automation/n09230945.asp");
IPAddress address = IPAddress.Parse(html);
Tracker.CurrentVisit.GeoIp =
Tracker.Visitor.DataContext.GetGeoIp(address.GetAddressBytes());
}
}
}