.NET技术支持者

  博客园 :: 首页 :: 博问 :: 闪存 :: :: 联系 :: 订阅 订阅 :: 管理 ::

            
if(!File.Exists("c:\\user.ini"))
            
{
                StreamWriter sw 
= new StreamWriter("c:\\user.ini");
                
string strName = tbName.Text;
                
string strPass = tbPass.Text;
                
string strEncryPass = System.Web.Security.FormsAuthentication.
                    HashPasswordForStoringInConfigFile(strPass,
"md5");
                sw.WriteLine(strName);
                sw.WriteLine(strEncryPass);
                sw.Close();
                
// 数据加密函数System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strPass,"md5")
            }

            
else
            
{
                
//从user.ini中读出保存的用户名称和密码,进行比较
                StreamReader sr = new StreamReader("c:\\user.ini");
                
string strSaveName = sr.ReadLine();
                
string strSavePass = sr.ReadLine();
                sr.Close();
                
string strInputPass = System.Web.Security.FormsAuthentication
                    .HashPasswordForStoringInConfigFile(tbPass.Text,
"md5");
                
if(strSaveName!=tbName.Text||strSavePass!=strInputPass)
                
{
                    Response.Write(
"用户名称或密码错误!");
                    mainPanel.Visible 
= false;
                }

                
else
                    Response.Write(
"<script language = javascript>alert('成功登录!')</script>");
            }
数据加密
    方法一:
  
posted on 2005-10-14 17:53  LDAR泄漏检测与修复  阅读(554)  评论(0编辑  收藏  举报