On some reasons some users get null
AnonymousID
on my site. I want to reset them to new Guids
, but how?
Trying to do this:
public void AnonymousIdentification_Creating(object sender,
AnonymousIdentificationEventArgs args)
{
args.AnonymousID = Guid.NewGuid().ToString();
}
And this:
protected void Application_EndRequest(object sender, EventArgs e)
{
if (Request.IsAuthenticated && Request.AnonymousID == null)
{
System.Web.Security.
AnonymousIdentificationModule.ClearAnonymousIdentifier();
}
}
AnonymousID
reset to null, but not assing new. And no AnonymousIdentification_Creating
invokes.
It there any way manually set or reset to new AnonymousID
?
UPDATED: <anonymousIdentification enabled="true" />
also.
By default Anonymous Identification is disabled in MVC. To enable this, you need to add the following tag in web.config under configuration => system.web tag:
<anonymousIdentification enabled="true" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.