View Single Post
  #1 (permalink)  
Old January 9th, 2006, 02:50 PM
chafor chafor is offline
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default static Class in ASP

Hi, I want to make a static class for my special function like MD5String. I'm pretty sure of my syntaxe but the compilator says on then line (public static class CMD5) : "c:\inetpub\wwwroot\HelloWorld\CMD5.cs(8): Le modificateur 'static' n'est pas valide pour cet élément" or in english : "The modificator 'static' is not valide for this element"

    public static class CMD5
    {
        public static string MD5String(string password)
        {
            MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvi der();
            byte[] bs = Encoding.UTF8.GetBytes(password);
            bs = x.ComputeHash(bs);
            StringBuilder s = new System.Text.StringBuilder();
            foreach (byte b in bs)
            {
                s.Append(b.ToString("x2").ToLower());
            }
            password = s.ToString();
            return password;
        }
    }