首页 新闻 会员 周边

这里有个小错误,请问这小段代码该怎么改?高手进..谢谢!

-1
[已解决问题] 解决于 2011-12-22 15:18

using System;
using System.IO;
using System.Text;
using System.Security;
using System.Web.Security;//这个命名空间明明有的,他还是报错..为什么啊?
using System.Security.Cryptography;

namespace Test
{
    public class Security
    {
        public string EncryptPassword(string PasswordString, string PasswordFormat)
        {
            string encryptPassword = null;
            if (PasswordFormat == "SHA1")
            {

                encryptPassword = FormsAuthorication.HashPasswordForStoringInConfigFile(PasswordString, "SHA1");
                
            }
            else if (PasswordFormat == "MD5")
            {
                encryptPassword =FormsAuthorication.HashPasswordForStoringInConfigFile(PasswordString, "SHA1");
            }
            return encryptPassword;
        }
    }
}
建一个项目,添加这个类,运行的时候报错...要怎么改才正确呢?谢谢!

hexllo的主页 hexllo | 菜鸟二级 | 园豆:318
提问于:2011-12-12 10:54
< >
分享
最佳答案
1

不不是没有引用?

农民工老李 | 菜鸟二级 |园豆:423 | 2011-12-15 15:34

要引用.NET的System.Web;组件,而不只是引用System.Web命名空间.

hexllo | 园豆:318 (菜鸟二级) | 2011-12-22 15:19
其他回答(2)
-2

  string encryptPassword = null;

tomfang | 园豆:271 (菜鸟二级) | 2011-12-12 11:48
-1

aaa

blog_冬 | 园豆:210 (菜鸟二级) | 2011-12-12 14:00
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册