加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

webserive 用xml写的 登陆方法

发布时间:2020-12-16 05:10:20 所属栏目:百科 来源:网络整理
导读:public string Select(string id,string ps) { //File.WriteAllText("D:/users/anmj/documents/visual studio 2010/Projects/Bill/Bill/123.xml",Encryption.Encrypt(str)); string strpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBa
public string Select(string id,string ps) { //File.WriteAllText("D:/users/anmj/documents/visual studio 2010/Projects/Bill/Bill/123.xml",Encryption.Encrypt(str)); string strpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "XmlDataUserXml.xml"; XmlDocument doc = new XmlDocument(); #region 验证 try { if (!File.Exists(strpath)) { XmlDeclaration xmldeclaration = doc.CreateXmlDeclaration("1.0","UTF-8","yes"); doc.AppendChild(xmldeclaration); XmlElement xmlelement = doc.CreateElement("Users"); doc.AppendChild(xmlelement); doc.Save(strpath); } doc.Load(strpath); XmlNodeList node = doc.DocumentElement.SelectNodes("User[@ID="" + id + ""]"); if (node.Count > 0) { foreach (XmlNode item in node) { if ((item as XmlElement).GetAttribute("Password") == Encryption.Encrypt(ps)) { Application["User_id"] = (item as XmlElement).GetAttribute("ID"); return "Home.aspx"; } } return "#"; } else return "#"; } catch { return "#"; } #endregion }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读