FormsAuthentication.HashPasswordForStoringInConfigFile 方法是一个在.NET 4.5中已经废弃不用的API,参见:

https://msdn.microsoft.com/zh-cn/library/system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(v=vs.110).aspx

This is a solution for SH1 variant.

     public static string GetSwcSH1(string value)
{
SHA1 algorithm = SHA1.Create();
byte[] data = algorithm.ComputeHash(Encoding.UTF8.GetBytes(value));
string sh1 = "";
for (int i = ; i < data.Length; i++)
{
sh1 += data[i].ToString("x2").ToUpperInvariant();
}
return sh1;
}

For MD5 you only change algorithm to:

MD5 algorithm = MD5.Create();

参考:http://stackoverflow.com/questions/13527277/drop-in-replacement-for-formsauthentication-hashpasswordforstoringinconfigfile

System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string, string)已过时的解决办法的更多相关文章

  1. 【ASP.NET MVC】"[A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 ..."的解决办法

    1.错误页面: “/”应用程序中的服务器错误. [A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]System.Web ...

  2. 警告"System.Configuration.ConfigurationSettings.AppSettings”已过时,解决办法

    解决办法: 直接把ConfigurationSettings写成ConfigurationManager,但是提示没有ConfigurationManager语句.

  3. [A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]解决办法

  4. System.Web.Security 在winform中是什么命名空间呢

    des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStorin ...

  5. asp.net报错“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决办法

    来源:http://ajxfxb.blog.163.com/blog/static/56675086201411634336878/ 作者是:没完没了的工作 asp.net报错“尝试读取或写入受保护的 ...

  6. SQL Server 2008 R2评估期已过的解决办法

    SQL Server 2008 R2评估期已过的解决办法   发现问题 北美产品测试服每日随机任务没有刷新 每日随机任务是使用数据库作业定期执行操作,重置玩家随机任务项 排查问题  www.2cto. ...

  7. Mac打开应用提示已损坏的解决办法

    相信很多升级了最新Mac系统的用户在打开一些应用的时候都会出现“应用XX已损坏”的系统提示,安装这些应用的时候总是提示“已损坏,移至废纸篓”这类信息,根本无法打开应用. Mac打开应用提示已损坏的解决 ...

  8. ASP.NET MVC 4新建库项目中找不到 System.Web.Security 的引用

    .NET 4中,WebSecurity的引用已经不再System.Web中,而是转移到了System.Web.ApplicationServices Dll中,添加该Dll即可.

  9. System.Web.Optimization 找不到引用,教你如何解决?

    在vs 2017 创建 BundleConfig 时添加引用 using System.Web.Optimization 是报错 提示未找到 解决方法: 在最下端窗口中写入:Install-Packa ...

随机推荐

  1. nginx+tomcat实现动静分离(转)

    本文设计的动静分离结构 在本文中,我们将静态资源放在 A 主机的一个目录上,将动态程序放在 B 主机上,同时在 A 上安装 Nginx 并且在 B 上安装 Tomcat.配置 Nginx,当请求的是 ...

  2. netfilter/iptables 结构要点

    转载请注明:http://blog.csdn.net/yeasy/article/details/44311169 四张表,每一个表有若干链. filter INPUT(路由表决策后,到本机的进程) ...

  3. UVA10375 Choose and divide 质因数分解

    质因数分解: Choose and divide Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

  4. java 正则表达式提取html纯文本

    本文来自我的个人博客: java 正则表达式提取html纯文本 做内容的大家都知道,从html中直接提取纯文本是一个非常大的问题.现将我做的正则匹配贴上: import java.util.regex ...

  5. 如何生成可变表头的excel(转)

    1.实现功能: 传入一个表头和数据,将数据导入到excel中. 为了便于项目的扩展,数据传入通过泛型集合传入,获取数据时,通过反射的方式获取,这样无论你的表头是多少项,我都能很方便的生成.另外为了便于 ...

  6. PHP 模板方法模式使用

    模板方法模式 用于各个子类均需实现类似的步骤,但是在这些步骤过程中,有各个子类不同的实现方法,也有他们公共的实现方法. 示例代码: //==================== //模板方法模式 // ...

  7. thoughtworks笔试整理

    笔试了,时间1个半小时.没想到居然有7/10是开放性问题.大意例如以下:1.为什么选择增加ThoughtWorks.200字以内,不能用"interesting"."ch ...

  8. Do a “git export” (like “svn export”)?(转)

    Probably the simplest way to achieve this is with git archive. If you really need just the expanded ...

  9. 采用 HTML5 File API 达到client log

    http://www.ibm.com/developerworks/cn/web/1210_jiangjj_html5log/ 版权声明:本文博主原创文章,博客,未经同意不得转载.

  10. 获取调用者Class和method、反射获取get方法、获取注解信息

    调用者Class 及 method StackTraceElement stacks[] = Thread.currentThread().getStackTrace(); for (StackTra ...