Hot answers tagged

12

With no obvious way of making Sitecore do our bidding, and me not finding any IIS configuration way of achieving this - I opt for a third solution. Enter a HttpModule to achieve this. Function is fairly simple. Outgoing, any SC_ANALYTICS_GLOBAL_COOKIE will get removed and our own MY_COOKIE added, with the same value. Ingoing, any incoming MY_COOKIE will ...


9

First of all, just to make it 100% clear: if you've disabled the tracker, then you can't track anything. No consent is required for session tracking According to the "EU cookie law", you cannot store certain types of information in the user's browser without the user's consent. Some cookies are covered by this, but not all of them. For example, session ...


8

You can create your own class: public class ClearCookieHttpModule : IHttpModule { public void Dispose() { } public void Init(HttpApplication context) { //hook end request context.EndRequest += new EventHandler(OnEndRequest); } void OnEndRequest(object sender, EventArgs e) { ...


8

xDB online visits, in most cases, map one-to-one to ASP.NET sessions. Generally, ASP.NET sessions are tracked in the browser using the cookie ASP.NET_SessionId, and the actual visit state (including the InteractionId) is kept in the session store you've configured in Sitecore. The reason I said "in most cases" in the sentence above is because there are ...


7

I am not sure if there is an easier way to do this. But I've achieved this before by setting a custom language cookie and then set the context language in a HttpRequest pipeline processor based on the value of your custom language cookie. When you switch language on the website then you can just set the value of your own custom language cookie and then you ...


6

There is no out of the box way to do this, you need to customize Sitecore.Context.SetLanguage function as /// <summary> /// Sets the current language. /// This to extend the sitecore default SetLanguage behavior by adding expiration date for the language cookie /// </summary> /// <param name="language">The language.</param> /// <...


5

As you suspect; this is now session based. The principle works like this. Every time a new session starts; 2 sessions are actually kicked off on the server. A Device Session correspond to a contact making an interaction using a device. A device session begins with the first page request but also captures other requests made during the same time ...


4

Change all cookies to SameSite=None A new KB article for SameSite with Federated Authentication is now available. In this article, one of the changes it suggests to make allows for ALL generated cookies to be set to SameSite=None. Configure the default values of cookies in the <system.web> section of the web.config file as follows: <httpCookies ...


4

Unfortunately, there is not a way to do this. Have a look at the Sitecore.Analytics.Web.ContactKeyCookie class. You will find the following constant there: private const string AnalyticsGlobalCookieName = "SC_ANALYTICS_GLOBAL_COOKIE"; The above means that the cookie name is hard-coded into Sitecore and cannot be changed. In addition to the above, ...


3

This may be a recent change (checked in 8.2 Update 4) - but the Sitecore API has an overload for the Sitecore.Context.SetLanguage method that should do what you want: Notice the 4th argument of DateTime? /// <summary> /// Sets the current language for current request, and can persist it for given site for specified duration via cookie. /// </...


2

I don't think this is possible without custom code. The string appears hardcoded twice in sitecore libraries. Sitecore.Analytics.dll namespace Sitecore.Analytics.Web { public class ContactKeyCookie { private const string AnalyticsGlobalCookieName = "SC_ANALYTICS_GLOBAL_COOKIE"; ..... ..... } }


2

You will have to do this yourself. When the Language property of the current Context is set, Sitecore will store this as a cookie. However these are done via static-methods that can't be overridden. You can either implement your own cookie, as per Jonas' answer, or you could add a pipeline processor that runs at the end of the HttpRequest that overrides the ...


2

No matter what, if you identify the user each time they log in, you will be fine. Tracker.Current.Session.IdentifyAs(source, identifier); If the husband is logged in, you will notice the Tracker.Current.Session.Contact.ContactId will be one ID. And when you IdentifyAs() the wife, the ID will change to her contact ID. The husbands session will time out and ...


2

I've seen this happen with the Forms Authentication cookie before. Multiple instances of the same cookie get added and the most specific domain wins. I ended up creating a method to remove all but the first instance of the cookie from the HttpContext.Current.Response.Cookies collection. I found the first cookie in the collection to be the correct one in my ...


1

I wouldn't recommend overwriting cookies that are set by the platform generally. I usually recommend make your own which you have full control over. Cookie editing is limited by domains. You couldn't edit it cross domain. Quote from mozilla when talking about cookies: Additionally, restrictions to a specific domain and path can be set, limiting where the ...


1

Thanks to Hishaam Namooya who gave me the idea to the solution in his comment. Instead of creating the new ticket in the new version. I will make every version responsible for its own ticket cookie creation. The .aspxauth cookie is already shared between the 2 sitecore instances of different version. So I can check the user from there and call the code to ...


1

Are the sites on different domains? If so, I suspect it's a cookie issue. By default, Sitecore (and ASP.NET) will use a very specific domain for its cookies to limit the cookies to only that domain. Since cookies cannot be shared across domains, when you switch domains, Sitecore can't see the language cookie anymore. To resolve this, I would recommend ...


1

Sitecore rays it as bug in their tracking system (reference number 232082) and provide a possible workaround which is worked for me. Open the “\Website\sitecore\shell\Applications\Content Manager\Content Editor.js” file. Replace the following lines: scForm.setCookie("scContentEditorFoldersWidth", pos); scForm.setCookie("scContentEditorFolders", visible ...


1

Seems that one does not have to authentication cookie after calling Sitecore.Security.Authentication.AuthenticationManager.Login() FormAuthentication.SetAuthCookie will be called after successful login. Source https://cprakash.com/2014/09/12/sitecore-form-authentication-cookie-renewal-sliding-expiration/


1

There are really 2 questions here. So lets deal with each of them: 1. Should I display a cookie notice? The answer to that is not really opinion based, its a legal issue. If you run a website that is owned in the EU you must make sure that your website complies with the latest "cookie laws" - The law is fairly detailed, but the basics say that: ...


Only top voted, non community-wiki answers of a minimum length are eligible