你对象名都有问题.肯定不存在啊...
给你一个以前写的.:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
using System.Text;
namespace BLL
{
public class Encrypt
{
///
/// MD5加密
///
/// 要加密的值
///
public static string Md5(string str)
{
try
{
byte[] hashvalue = (new MD5CryptoServiceProvider()).ComputeHash(Encoding.UTF8.GetBytes(str));
return BitConverter.ToString(hashvalue);
}
catch
{
return String.Empty;
}
}
}
}
MD5的Dll未添加为引用,或者在此代码所在源文件中 未对 MD5的命名空间使用Using
你没有引用System.Security.Cryptography
引用using System.Security.Cryptography;
你刚开始学写程序啊? 方法名和实例化的对象名都重复了,那怎么用啊...