Hi there,
You could delete all the cookies in your browser (through the Options dialog, or by using the Developer Toolbar (when using IE; press F12)).
Alternatively, you can wrap the code in a try/catch block. The book contains a forward reference to chapter 18 that digs deeper into error handling. For now, you could try changing the line that set the Theme to something like this in the BasePage:
Code:
C#
try
{
Page.Theme = preferredTheme.Value;
}
catch
{
Request.Cookies.Remove("PreferredTheme");
}
VB
Try
Page.Theme = preferredTheme.Value
Catch
Request.Cookies.Remove("PreferredTheme")
End Try
This code tries to set the Theme, and then deletes the cookie when that fails, as it's likely that the cookie contains a value without a matching theme.
Hope this helps,
Imar