AnonymousID始终返回null

时间:2016-05-19 10:40:45

标签: c# asp.net

我试图在用户未登录时设置asp.net C#中的AnonymousID;在我的Global.asax.cs文件中,我已经添加了这个类来设置它:

protected void AnonymousIdentification_Creating(object sender, AnonymousIdentificationEventArgs e)
    {
        e.AnonymousID = Guid.NewGuid().ToString();
    }

然后在我的CurrentUser课上,我这样做了:

userId = HttpContext.Current.Request.AnonymousID;

然而,AnonymousID 总是 null,它永远不会被设置。

注意:提出了类似问题的上一个问题,但实际解决方案从未发布过:

AnonymousId is always null

1 个答案:

答案 0 :(得分:1)

清除Cookie,它将开始工作。

相关问题