Monday, August 21, 2006

I Just 'Saw'

part II
, can't wait to 'see' part III

Monday, August 14, 2006

Wednesday, August 09, 2006

(Milk) without Cookies

ASP.NET Forms-authentication doesn't 'work' when a (browser)client refuses cookies. Specifying 'cookieless="AutoDetect"' in 'web.config' will make log-in/out possible.

<authentication mode="Forms">
    <loginUrl="login.aspx" defaultUrl="default.aspx" cookieless="AutoDetect" />

1. Disable cookies in IE
Go to: menu 'Tools' - 'Internet Options...' - (3th) tab 'Privacy' - button 'Advanced...'.
ATTENTION: IE only allows to refuse cookies in the 'internet zone'!

2. Run the Visual Studio 2005 webserver in an 'internet zone-context'.
By default the VS2005 webserver runs in the 'intranet zone'. To 'switch zones' use a full IP-address instead of 'localhost'; so if your website runs at 'http://localhost:28894/myWebsite/' use ''. Notice the 'internet'-zone-icon in the statusbar.

After a successful (forms-)authentication, You will see something like this '' in IE's navigationbar. The red-colored-text is a 'URL-based-cookie'.

Thursday, August 03, 2006

U Know What 2 Do!

Digg This!

(Read as: just added 'Digg This!' for each post.)

Tuesday, August 01, 2006

Hierarchical iteration à la .NET 2.0

E.g. a foreach-iteration over the (sub)items of a (System.Web.UI.WebControls.)Menu or TreeView...

private delegate ICollection GetChildrenDelegate<T>(T parent);

private IEnumerable<T> getHierarchicalItems<T>(
   ICollection source
   ,GetChildrenDelegate<T> getChildren
   Queue<T> q = new Queue<T>();
   ICollection childs = source;

   while (true)
      foreach (T item in childs)
         yield return item;

         if (getChildren(item).Count > 0)

      if (0 == q.Count) { break; }
      childs = getChildren(q.Dequeue());

Iteration over Menu/-Items
GetChildrenDelegate<MenuItem> getSubMenus =
   delegate(MenuItem current)
         return current.ChildItems; 

foreach (MenuItem item in this.getHierarchicalItems<MenuItem>(
   , getSubMenus))

Iteration over Tree-View/-Nodes
GetChildrenDelegate<TreeNode> getSubNodes =
   delegate(TreeNode current)
         return current.ChildNodes;

foreach (TreeNode item in this.getHierarchicalItems<TreeNode>(
   , getSubNodes))