Cookiemanager (C#)

Posted by Sem Dendoncker on June 11th, 2010

Hello,

In many of my applications I need to transfer the data from one page to another.
I used to do this by using a session but the thing with sessions is that they are unreliable.
You never know when they will disappear. There are several possibilities that a session can disappear (session timeout, application needs more memory, …).

The I thought about another way to do this. Then I thought why not using encrypted querystrings but that idea was countered real hard on stackoverflow.com (http://stackoverflow.com/questions/2989703/how-can-you-secure-encrypt-your-querystring-in-asp-net).

Finally I used one of the suggested solutions, why not putting your essential data into a cookie.
Therefore I’ve created an object called “CookieManager”.

Basically it works as a dictionary that contains all the properties you like/want.
You can add/remove properties (with their values) very easely.

This is the code to add a property

CookieManager manager = new CookieManager(cookieName, true);
manager.SetPropertyValue(property, value)

This is the code to get the value of a property

CookieManager manager = new CookieManager(cookieName, true);
manager.GetPropertyValue(property);

This is the code to remove a property

CookieManager manager = new CookieManager(cookieName, true);
manager.RemoveProperty(property);

Easy no?

I’m still working on a full manual for the manager, but the object is so easy to use anyone could use it.
For the ones who would like to have the sourcecode, just leave a comment and I’ll email it to you.

You can download the dll here

Cheers,
M.

Upgrading to enterprise library 5.0 makes the attribute validators fail.

Posted by Sem Dendoncker on June 10th, 2010

Hi,

Today I’ve upgraded my microsoft enterprise library 4.1 version to the 5.0 version.
After recompiling I got the error: “Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator is not an attribute class”.
The first thing I thought was “Now what”!!

Fortunatly I have found the solution for this problem.
The only thing you need to do is to add the reference “System.ComponentModel.DataAnnotations” to your project and all errors will disappear.

I’m very pleased with the upgrade.
Keep it up!

Cheers,
Sem

Searching subfolders in outlook 2007

Posted by Sem Dendoncker on April 4th, 2010

Hi all,

The other day I wanted to search a folder (and it’s subfolder) in outlook 2007.
I’ve tried the normal way of searching (using the little searchbox), but this one search function does not search any subfolders.

But there is a solution to this. Click the folder you want to search, press “ctrl+shift+F” or go to “tools – instant search – advanced find”.
There you’ll have a lot of search options, but you want to click “browse” and at the bottom of the screen check “Search subfolders”.

If you search now, the search will include all subfolders as well.

Cheers,

Sem


Copyright © 2007 Sem Dendoncker. All rights reserved.