Standing on the shoulders of giants. RSS 2.0
# Wednesday, July 27, 2005

public static string HashPasswordForStoringInConfigFile(
   string password,
   string passwordFormat
);

In the FormsAuthentication class in the System.Web.Security namespace.

The first parameter is the string you want hashed, the second is the hashalgorithm, “sha1” or “md5”, to use.

[more info on msdn]

Wednesday, July 27, 2005 5:22:06 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Codesnippet | Development
# Wednesday, July 20, 2005

Be sure to visit all the options under "Configuration" in the Admin Menu Bar above. There are 16 themes to choose from, and you can also create your own.

Test

Wednesday, July 20, 2005 9:00:00 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
dasBlog
# Tuesday, July 19, 2005

For the first time ever the help system will be user customizable; users can add their own notes to the pages for future reference.

Hope they allow you to share these annotations through some kind of community, but sounds cool.

[source: ars technica]

Tuesday, July 19, 2005 9:50:51 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Longhorn
# Monday, July 18, 2005

This code shows how to deserialize a string containing xml to an object using a StringReader and an XmlTextReader (remember to insert a using-statement, where appropiate). The deserialized class also shows how to handle xml-arrays using the serialization attributes.

// ===============================================================================
// Copyright (C) 2005 Paul van Brenk
// All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
// ==============================================================================
// Deserializing a string containing xml and an xml-array.
// ==============================================================================


using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;

public class MyClass
{
    public static void Main()
    {
    
        string xml = "<person>" +
                        "<firstname>Paul</firstname>" +
                        "<lastname>van Brenk</lastname>" +
                        "<addresses>" +
                        "    <address>" +
                        "        <street>Home Street</street>" +
                        "        <number>80</number>" +
                        "        <postalcode>1000 AA</postalcode>" +
                        "        <city>Home Town</city>" +
                        "        <country>The Netherlands</country>" +
                        "    </address>" +
                        "    <address>" +
                        "         <street>Work Street</street>" +
                        "        <number>100</number>" +
                        "        <postalcode>1000 BB</postalcode>" +
                        "        <city>Work Town</city>" +
                        "        <country>The Netherlands</country>" +
                        "    </address>" +
                        "</addresses>" +
                    "</person>";
                    
        XmlSerializer ser = new XmlSerializer( typeof(Person) );
        
        StringReader reader = new StringReader(xml);
        XmlTextReader xmlReader = new XmlTextReader(reader);
        
        Person person = (Person)ser.Deserialize(xmlReader);
    }
}

[XmlRoot("person")]
public class Person{

    public Person(){
        // required for serializer
    }
    
    [XmlElement("firstname")]
    public string FirstName;
    [XmlElement("lastname")]
    public string LastName;
    
    //defines the arraynode
    [XmlArray("addresses")]
    // defines the node in the array
    [XmlArrayItem("address")]
    public Address[] Addresses{
        get{
            if(this.addresses == null ){
                return new Address[0];
            }
            return this.addresses;
        }
        set{
            this.addresses = value;
        }
    }

    [XmlAnyElement()]
    public XmlElement[] UnknownElements;

    private Address[] addresses;
}

// this attribute has no influence on the rendering
// of the element as part of an Xml-array.
[XmlRoot("address")]
public class Address{

    public Address(){
        // required for serializer
    }
    [XmlElement("street")]
    public string Street;
    [XmlElement("number")]
    public int Number;
    [XmlElement("postalcode")]
    public string PostalCode;
    [XmlElement("city")]
    public string City;
    [XmlElement("country")]
    public string Country;
}

Monday, July 18, 2005 5:07:03 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Codesnippet

SeaMen screenshot

Mart Muller: There is a lot of talk about AJAX lately. It's not new but there are a lot of cool things that you could do with it. Some guys at Tam Tam dove into it and gave a session about it last week. One of the "demo's" they've built is "Seamen - Massive Multiplayer Battleships". A cool AJAX example I do not want to keep away from you!

[note: it’s kinda slow right now, but that’s probably due to the hosting, it’s hosted from a home-adsl connection.]

Monday, July 18, 2005 10:34:34 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Development | Fun
# Friday, July 15, 2005

Returning an ArrayList is as bad or worse as returning an object from most methods, so don’t. When you return an ArrayList, anything could be in there, so I have to try and read your code, or hope your documentation is still correct, to find out what’s in there. A much nicer and more type-safe solution is to return an Array of the objects in your ArrayList, which is only 1 line of code more.

    public ArrayList BadNumbers{
        get{
            return this.items;
        }
    }
    
    public int[] GoodNumbers{
        get{
            if( numbers == null ){
                // it's not nice to return a null reference, when
                // an Array is expected.
                // That would mess up your foreach loop badly.
                return new int[0];
            }
            
            // conversion is done here instead of at the call site
            return (int[])numbers.ToArray(typeof(int));            
        }
    }
    
    private Arraylist numbers = new ArrayList();

Friday, July 15, 2005 11:33:58 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1] - Trackback
Codesnippet | Development
# Thursday, June 23, 2005

Interesting and annoying behaviour of Asp.Net with respect to HttpModules; the httpModules element in a web.config in a subdirectory, (note: not a seperate application) are ignored. No warning, no error, no nothing, just ignored.

After I spend the better part of yesterday afternoon working on this problem and google wasn’t very helpfull, I hope this will be helpfull to someone.

Proof of concept:

Solution

Layout of the project, notice the second web.config in the subdirectory.

HttpModules element in the root web.config:

<httpModules>

         <add name="FirstHttpModule" type="httpModule.HttpModules.FirstHttpModule, httpModule" />

httpModules>

Interesting part of the FirstHttpModule class

private void context_BeginRequest(object sender, EventArgs e) {
    HttpApplication source = sender as HttpApplication;
    if( source != null ){
        source.Context.Response.Write( "Hello from FirstHttpModule. " );
    }
}

HttpModules element in the subdirectory web.config:

<httpModules>

<clear />

         <add name="SecondHttpModule" type="httpModule.HttpModules.SecondHttpModule, httpModule" />

httpModules>

Interesting part of the SecondHttpModule class:

private void context_BeginRequest(object sender, EventArgs e) {

private void context_BeginRequest(object sender, EventArgs e) {
    HttpApplication source = sender as HttpApplication;
    if( source != null ){
        source.Context.Response.Write( "Hello from SecondHttpModule. " );
    }
}

Result of a request to webform1.aspx in the root:

FirstModule

Result of a request to webform1.aspx in the subdirectory:

SecondModule

 

Source for the proof of concept: httpModule.zip (17.17 KB)
Thursday, June 23, 2005 3:53:41 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1] - Trackback
ASP.NET
# Friday, May 20, 2005

Mart is experimenting with WSS 2.0 on windows 2003 R2, he just posted his first article on the installation.

Friday, May 20, 2005 11:24:17 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
ASP.NET | Office 2007
# Thursday, May 19, 2005

I saw it tonight, this review by Anthony Lane accurately describes how I feel about it.

And now I would like those 2 hours of my live back please.

[link via Tim Bray's Ongoing]

Thursday, May 19, 2005 12:56:13 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Film
About
© Copyright 2008
Paul van Brenk
Sign In
newtelligence dasBlog 2.3.8275.16006
All Content © 2008, Paul van Brenk
DasBlog theme 'Business' created by Christoph De Baene (delarou)