MarkItUp.Web.Personalization
A couple of weeks ago I uploaded an assembly that I've been dinking around with to encapsulate operations on cookies, I've just uploaded a new version that fixes some logic errors and you can get it here: Download the bits.
I'd love to get some feedback about this class because, I had mixed reviews from people regarding its usefulness. Basically most people have said "Why would you want to do that?". If it seems as though this class would be viewed as useful then I'll upload the source for download too! Oh yeh, for anyone that downloaded the previous version... I've changed the namespace from MarkItUp.Web.Utilities.Personalization to MarkItUp.Web.Personalization :-)
Here's the blurb taken from the .chm file contained within that download...
Currently, when writing values to cookies, there is quite a bit of repetitive code that is required, for example, take the following example which adds a value to the "LastEnteredValue" key of the cookie named "WebForm1":
Dim c As HttpCookie = Request.Cookies("WebForm1")
If c Is Nothing Then
c = New HttpCookie("WebForm1")
End If
c.Item("LastEnteredValue") = TextBox1.Text
c.Expires = DateTime.Now.AddDays(2)
Response.Cookies.Add(c)
The Personalization class in the MarkItUp.Web.Personalization assembly simplifies this by removing the need for all of the repetitive lines of code, so, the above example can be reduced to:
Dim p As New Personalization("WebForm1")
p.Items("EntryB") = TextBox1.Text
In addition to that, the Personalization class adds the ability to easily remove an entry from a Personalization store:
Dim p As New Personalization("WebForm1")
p.Remove("ShowReminderButton")
As well as simplifying the task of setting fixed expiry dates:
Dim p As New Personalization( "TooGoodToBeTrueDeal", DateTime.Now.AddHours(6) )
p.Items("UserHasEntered") = "true"