Following the code for inserting and defining cookies, (which, of course does work OK), and in the process of testing my own competence I made a typo in defining the values in the DDL in MasterPage/Master, which should have included the line:
<div id="SideBar">Select a Theme
<asp:DropDownList ID="lstPreferredTheme" runat="server" AutoPostBack="True"
Being less than careful in entering the line I inadvertently entered
with the embedded space. Stupid, yes! Careless, yes! However, as this forced me into error mode as the 'Dark Grey' theme did not exist I had to remove the cookie to continue. I achieved this by drilling into
and deleting the specific cookie. This was more of a chore than an inconvenience, but later I did further checking and found that if I changed the code in MasterPage.master.cs from
protected void lstPreferredTheme_SelectedIndexChanged(object sender, EventArgs e)
preferredTheme.Expires = DateTime.Now.AddMonths(3);
preferredTheme.Expires = DateTime.Now.AddDays(-1);
I could clear the cookie instantly.
I wonder if it may be worth adding some clarification in future editions to provide a more elegant method of killing an invalid, or incorrect cookie. For all of the usual reasons I would have been loathe to clear all cookies, (something of an overkill in this case), and I have no real issues with drilling down, but perhaps the programmatic method is both 'safer' and perhaps more elegant.
There again, I suspect that not many people will run into this issue anyway.