技巧应用:ASP.Net中的MD5加密
2008-05-01 04:37
295 查看
.MDj242{display:none;}其实在ASP.Net编程中,不用调用MD5.ASP来加密数据。在DotNet中有自带的类:
System.Web.Security.HashPasswordForStoringInConfigFile()以下是引用片段:
publicstringMD5(stringstr,intcode)
{
if(code==16)//16位MD5加密(取32位加密的9~25字符)
{
returnSystem.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16);
}
if(code==32)//32位加密
{
returnSystem.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}
return"00000000000000000000000000000000";
}
System.Web.Security.HashPasswordForStoringInConfigFile()以下是引用片段:
publicstringMD5(stringstr,intcode)
{
if(code==16)//16位MD5加密(取32位加密的9~25字符)
{
returnSystem.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower().Substring(8,16);
}
if(code==32)//32位加密
{
returnSystem.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5").ToLower();
}
return"00000000000000000000000000000000";
}
相关文章推荐
- 技巧应用:ASP.Net中的MD5加密
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- ASP.NET应用技巧:非托管COM组件的使用
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- ExtAspNet应用技巧(三) - 302与Asp.Net Ajax
- [ZT]应用技巧:ASP和ASP.Net共享Session解决办法
- asp.net ajax应用技巧之方法的重载
- ExtAspNet应用技巧(三) - 302与Asp.Net Ajax
- 【.NET应用技巧】Asp.NET MVC 4 设置IIS下调试
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 轉自:提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧(转载)
- 性能调优之提高 ASP.NET Web 应用性能的 24 种方法和技巧
- ExtAspNet应用技巧(十四) - 系统设置
- ExtAspNet应用技巧(四) - 怪异的IE
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 提高 ASP.NET Web 应用性能的 24 种方法和技巧
- 分享提高ASP.NET Web应用性能的技巧