使用c#.net 读取服务器上USB 序号 以保证一个web程序只能用于一个机器. 我把连接数据库的地址写在了webconfig里, 这样他们就能看见连接SQL 帐号和密码了,  去SQL里自己该 USB 序列号.  
我应该怎么做.

解决方案 »

  1.   

    加密web.config中的连接字符串
    使用的时候再解密des
      

  2.   

    修改config文件System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration
    des,md5等加密用户名密码,获取解密
    加密连接字符串
    FileInfo fileinfo = new FileInfo(Context.Parameters["targetdir"] + "\\web.config");
      XmlDocument xmldocument=new XmlDocument();
      xmldocument.Load(fileinfo.FullName);
      foreach(XmlNode node in xmldocument.SelectSingleNode("appSettings").ChildNodes)
      {   
      if (node.Name == "add")
      {   
      if (node.Attributes.GetNamedItem("key").Value == "connString")
      {
      node.Attributes.GetNamedItem("value").Value= "';
      }   
      }   
      }
      xmldocument.Save(fileinfo.FullName);