zoukankan      html  css  js  c++  java
  • c# -- 解决FromsAuthentication上下文不存在

    使用 FormsAuthentication.HashPasswordForStoringInConfigFile("需要加密的字符串", "MD5")这个方法进行加密时,编译器显示“FormsAuthentication上下文不存在”。下面是部分代码,

    for(Int32 i = 100; i <= 1750; i++)
    { String ii
    = i.ToString(); string strmd5 = FormsAuthentication.HashPasswordForStoringInConfigFile(ii, "md5");
       ……
    }

    然后检查一下代码,发现还有一个报错,

    using System.Web.Security;

    这句代码编译器也报错,命名空间“System.Web”中不存在类型或命名空间名称“Security”。

    发现是因为没有添加引用“System.Web”。需要添加这个应用。

    添加步骤:打开项目 -- 添加引用 -- 选择System.Web(在.NET目录下的) -- 确定

     这样,上面两个错误就消失了,问题解决。

  • 相关阅读:
    招行面试
    今日头条面试[教育岗]
    四方精创 面试
    ArrayList 源码
    redis缓存,穿透,击穿,雪崩
    hashMap
    集合整理
    阿里CBU技术部一面
    网安面试
    php递归获取顶级父类id
  • 原文地址:https://www.cnblogs.com/lmei/p/3482408.html
Copyright © 2011-2022 走看看