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目录下的) -- 确定

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

  • 相关阅读:
    ado.net
    sql基础
    css样式
    HTML基础加强
    socket网络编程
    网络聊天室
    多线程
    WinForm基础
    使用Maven插件(plugin)MyBatis Generator逆向工程
    SpringBoot使用thymeleaf时候遇到无法渲染问题(404/500)
  • 原文地址:https://www.cnblogs.com/lmei/p/3482408.html
Copyright © 2011-2022 走看看