Just another note on cookies, about the way to delete them.
Because you can't have access obviously to the user disk to delete your cookie, you have to do something like this:
Response.Cookies("MyCookie").Expires = DateTime.Now.AddDays(-30)
Great, it works but not immediatly. So I suggest that you write again the cookie with empty values to really empty the cookie before it disappear.
I had to do that because the clipboard function I use is a panel visible or not.
So if I delete the cookie, and the user make visible the clipboard very quickly, the cookies values are still there. Emptied it solved the problem, well for me.
To be honest, I didn't used really cookies on a project since a very long time, but in Scoilnet, the education portal I am building for the Irish government,
here we go, I need it.
I had to implement a neat feature to let users, mostly teachers, keeping in a 'clipboard' some resources(HTML documents) for a certain period of time.
And indeed retrieve the content of their clipboard when they need it, today or in 10 days. Add to these requirements that they don't login to access the site, and., correct me if I am wrong, cookies ready to cook !
I remember vaguely that cookies implementation before was a piece of cake (sorry I couldn't missed this one;-)), so because .Net rocks, it would be easy.
Not so easy, indeed. It took me few hours to figure out how to make this working properly.
I discovered that when you write some values to a cookie, you need to check if the cookie exist to avoid an exception error.
Great, but when you write something like if request.cookies("Mycookie") is nothing then... you enter in a mysterious world.
To be more explicit, you have with .Net 2 types of cookies, the session one, and the persistent one. The first disappear when the user do the same, and the second stay on the user disk. The difference is just a tiny property Expires. If you pass to this an expiration date, it's persistent, otherwise not.
The problem, is when you do a test to check that the cookie is there, .Net for a reason which elude me, create the cookie, but with a null expiration date.
Yes you just guessed it, it's a session cookie. And now everything you can write in your cookie after that are not written to the disk, believe me I spend sometime to discover this.
In some scenario, it could be worse, if you use a watch in VS.Net, you create again this fugitive cookie.
The incoming (Request) cookie carries an Expires date of DateTime.MinValue, regardless of the date attached to the cookie on the client system.
Read this clever article on CodeProject to know more about this problem and a solution.
So my little solution is this one, I admit unclean, but unfortunatly not too much time. I am sure someone has a better explanation, but cookies and .Net are not the best ingredients for a good recipe.
' MyNewValue contain the name of the file the user want to add to the clipboard
Try
'// I use HasKeys to check that the cookie has some subvalues
If Request.Cookies("MyCookie").HasKeys then
Dim Myfilename as string = Request.Cookies("Mycookie")("filename").toString
Response.Cookies("MyCookie").Value = "clip"
Response.Cookies("MyCookie").Expires = DateTime.Now.AddDays(45)
Response.Cookies("MyCookie").Values.Add("filename", MyFileName & "@@" & MyNewValue)
Else
Strangely I was hoping that HasKeys will throw an exception if the cookie doesn't exist that's why I used the Try Catch, but sometime it does,
sometime not, and I am not yet sure why. This is why I add this Else repeating the same code. Unclean but it works !
Response.Cookies("MyCookie").Value = "clip"
Response.Cookies("MyCookie").Expires = DateTime.Now.AddDays(45)
Response.Cookies("MyCookie").Values.Add("filename", MyFileName)
End if
Catch ex as Exception
Response.Cookies("MyCookie").Value = "clip"
Response.Cookies("MyCookie").Expires = DateTime.Now.AddDays(45)
Response.Cookies("MyCookie").Values.Add("filename", MyFileName)
End Try
To read the cookie values, I just have to split the value from the cookie and write the result by a label for example:
Dim MyFileList as string() = Request.Cookies("Mycookie")("filename").Split("@@")
Hey Christophe, this Geoblog stuff is pretty cool.
I just wonder what's going to happen in case of success. It could be a little bit messy all this blogs popup from everywhere.
But it's really a feature to learn about the real world linked to the superficial world of Internet !
I like this idea of global Cafe du Commerce, with everybody talking about everything.
Come on Scott, I am sure this will be on the next update.
Oh God I like blogging :-))
UPDATE:
Oh better than better, I just found another bloke who blog here in Ireland.
Amazing, almost my neighbour. Well kind of, he's in Cork. But this tool, man, is really top of the top.
Because It's a Flash world map, you can also zoom in. Useful to separate closer dots on the map.
I know, I am still a kid who never grew up, but hey whatever !
So that's it Apple move in the music business, after Microsoft few months ago who announced some interest with Hollywood ! Not sure about the 200 000 songs origin, but it could be coming from Vivendi Music bought by Apple. Anyway no mention of that on their site.

Read on Techdirt:
In one of the worst kept secrets coming out of Apple in years, today they announced their own downloadable music service, with deals with each of the major record labels so that they have 200,000 songs to offer at $0.99/song. My initial reaction is that this is a step closer, but it's still not there yet. This is really a "me too" music downloading system, patterned on previous (failed) attempts to do the same thing with only minor improvements. First, the number of songs isn't nearly high enough (though, of course, that will improve), and the price is still too high. What the service does right is let people move the songs to an iPod (which you would expect, of course) and let people burn songs to a CD as many times as they want. The service is currently limited to Apple machines, but that will change with time. The bigger issue is that this absolutely takes away the benefits of offering music online. First, music sharing applications let people discuss, sample, share, and discover new music. Forcing people to pay $1/song doesn't encourage me to explore new music at all. Second, by making a distributed peer-to-peer system, distribution costs are dropped to next to nothing. So, this is a nice step for the music industry, but it's still missing the point. People are coming out saying that this will change the music industry - but I don't see that just yet. The only real "innovation" here (and it's incremental) is that you can burn the songs you download to CD.
The other new stuff is the Ipod 30 Gb