AndyButland / UmbracoPersonalisationGroups

Package for personalisation of content with Umbraco.
MIT License
38 stars 18 forks source link

Corrupt cookies cause site errors #16

Closed twaddell closed 5 years ago

twaddell commented 5 years ago

If the pages viewed cookie gets corrupted to not be a list of int the following exceptions occur and cause server errors site wide.

Exception message: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Enumerable.Contains[TSource](IEnumerable1 source, TSource value, IEqualityComparer1 comparer) at System.Linq.Enumerable.Contains[TSource](IEnumerable1 source, TSource value) at Zone.UmbracoPersonalisationGroups.Criteria.PagesViewed.RegisterApplicationEvents.AppendPageIdIfNotPreviouslyViewed(String viewedPageIds, Int32 pageId) at Zone.UmbracoPersonalisationGroups.Criteria.PagesViewed.RegisterApplicationEvents.TrackPageView(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The cookie would normally be in the form 1,2,3,4 but if it is modified to 1,2,bang,3,4 the exception will occur.

I have been unable to determine what causes the initial cookie corruption.

AndyButland commented 5 years ago

I've pushed up the fix you provided for this in version 0.3.6. Thanks again.