Created
June 4, 2022 10:46
-
-
Save ivanbuzyka/212f6dd1c9b1208b83d4ad5cbddf2016 to your computer and use it in GitHub Desktop.
The file to use for ending session in Sitecore 10.1 to flush the data from session store to xDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page language="c#" %> | |
<%@ Import namespace="Microsoft.Extensions.DependencyInjection" %> | |
<script runat="server"> | |
void Page_Load(object sender, System.EventArgs e) { | |
var identificationManager = Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetRequiredService<Sitecore.Analytics.Tracking.Identification.IContactIdentificationManager>(); | |
Sitecore.Analytics.Tracking.Identification.IdentificationResult result = identificationManager.IdentifyAs(new Sitecore.Analytics.Tracking.Identification.KnownContactIdentifier("directsource", "user_" + Guid.NewGuid())); | |
Sitecore.Analytics.Tracker.Current.EndTracking(); | |
Session.Abandon(); | |
Response.Write("Session is abandoned!"); | |
} | |
</script> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>end session</title> | |
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR"> | |
<meta content="C#" name="CODE_LANGUAGE"> | |
<meta content="JavaScript" name="vs_defaultClientScript"> | |
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> | |
<link href="/default.css" rel="stylesheet"> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment