Fixes: #U4-2214 - encrypted cookie value issue when it is invalid

This commit is contained in:
Shannon Deminick
2013-05-12 21:07:16 -10:00
parent 7d1a18638b
commit b38397868e
2 changed files with 18 additions and 4 deletions

View File

@@ -379,9 +379,16 @@ namespace Umbraco.Web.Security
return encTicket.DecryptWithMachineKey();
}
}
catch (HttpException ex)
catch (Exception ex)
{
// we swallow this type of exception as it happens if a legacy (pre 4.8.1) cookie is set
if (ex is ArgumentException || ex is FormatException || ex is HttpException)
{
StateHelper.Cookies.UserContext.Clear();
}
else
{
throw;
}
}
}
return "";

View File

@@ -267,9 +267,16 @@ namespace umbraco.BasePages
return encTicket.DecryptWithMachineKey();
}
}
catch (HttpException ex)
catch (Exception ex)
{
// we swallow this type of exception as it happens if a legacy (pre 4.8.1) cookie is set
if (ex is ArgumentException || ex is FormatException || ex is HttpException)
{
StateHelper.Cookies.UserContext.Clear();
}
else
{
throw;
}
}
}
return "";