public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string url = context.Request.Form["url"]; DomainUser user = new DomainUser(); if (context.Request.Form["lastname_add"] != "" && context.Request.Form["firstname_add"] != "" && context.Request.Form["loginname_add"] != "") { user.lastName = context.Request.Form["lastname_add"]; user.firstName = context.Request.Form["firstname_add"]; user.sAMAccountname = context.Request.Form["loginname_add"]; user.UserPrincipalName = context.Request.Form["loginname_add"]; if (context.Request.Form["displayname_add"] != "") { user.displayName = context.Request.Form["displayname_add"]; } if (context.Request.Form["description_add"] != "") { user.Description = context.Request.Form["description_add"]; } if (context.Request.Form["department_add"] != "") { user.Department = context.Request.Form["department_add"]; } if (context.Request.Form["telphone_add"] != "") { user.Telephone = context.Request.Form["telphone_add"]; } if (context.Request.Form["password_add"] != "" && context.Request.Form["confirmpwd_add"] != "") { user.UserPwd = context.Request.Form["password_add"]; string confim = context.Request.Form["confirmpwd_add"]; if (user.UserPwd == confim) { string domainip = context.Session["domainip"].ToString(); string domainname = context.Session["domainname"].ToString(); string username = context.Session["username"].ToString(); string password = context.Session["password"].ToString(); string dc = context.Session["dc"].ToString(); Operate op = new Operate(domainname, domainip, username, password, dc); string result = op.adduser(url, user); context.Response.Write(result); } else { context.Response.Write("The password entered for the two time is inconsistent!"); } } else { context.Response.Write("Password cannot be empty!"); } } else { context.Response.Write("Firstname、Lastname and Loginname is required!"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string url = context.Request.Form["url"]; string table = ""; string status = ""; //账户类型,控制是否显示操作按钮(visibility:visible)这里采用disabled属性 string image = ""; //是否禁用,不同状态的按钮显示不用文字; string hint = ""; //鼠标悬停提示文字 string domainip = context.Session["domainip"].ToString(); string domainname = context.Session["domainname"].ToString(); string username = context.Session["username"].ToString(); string password = context.Session["password"].ToString(); string dc = context.Session["dc"].ToString(); Operate op = new Operate(domainname, domainip, username, password, dc); List <DomainUser> domainuser = op.getAllUser(url); int count = domainuser.Count; if (count > 0) { for (int i = 0; i < count; i++) { if (domainuser[i].type == "user") { status = ""; } else { status = "disabled='true'"; } if (domainuser[i].state) { image = "../images/disable.png"; hint = "Disable"; } else { image = "../images/enable.png"; hint = "Enable"; } table += "<tr>"; table += "<td>" + domainuser[i].UserName + "</td>"; table += "<td>" + domainuser[i].type + "</td>"; table += "<td>" + domainuser[i].Description + "</td>"; table += "<td>" + "<button id = \"update\" title=\"Update\" class=\"btnchange\" onclick=\"Update('" + domainuser[i].UserName + "','" + domainuser[i].type + "')\"></button>" + "<button id = \"delete\" title=\"Delete\" class=\"btndelete\" onclick=\"Delete('" + domainuser[i].UserName + "','" + domainuser[i].type + "')\"></button>" + "<button id = \"check\" title=\"" + hint + "\" style=\"background-image: url('" + image + "')\" " + status + "\" class=\"btncheck\" onclick=\"Check('" + domainuser[i].UserName + "')\"></button>" + "<button id = \"move\" title=\"Move\" class=\"btnmove\" onclick=\"Moveto('" + domainuser[i].UserName + "','" + domainuser[i].type + "')\"></button>" + "</td>"; table += "</tr>"; } context.Response.Write(table); } else { context.Response.Write(""); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request.Form["name"]; string url = context.Request.Form["url"]; string domainip = context.Session["domainip"].ToString(); string domainname = context.Session["domainname"].ToString(); string username = context.Session["username"].ToString(); string password = context.Session["password"].ToString(); string dc = context.Session["dc"].ToString(); Operate op = new Operate(domainname, domainip, username, password, dc); string result = op.softdelete(url, name); context.Response.Write(result); }
public static OuTreeNode GetOuTree(string domainname, string username, string password, string domainip, string dc) { Operate op = new Operate(domainname, domainip, username, password, dc); string domainName = string.Empty; OuTreeNode rootNode = null; DirectoryContextType type = new DirectoryContextType(); DirectoryContext text = new DirectoryContext(type, op.adminUser, op.adminPwd); using (Domain domain = Domain.GetDomain(text)) { domainName = domain.Name; //使用域节点来构造OU树的根节点 Use the domain node to construct the root node of the OU tree rootNode = new OuTreeNode() { text = domainName }; //递归的查找子节点,构造OU树 Recursively finds the child nodes and constructs the OU tree GetOuTreeRecursivly(rootNode, domain.GetDirectoryEntry()); } return(rootNode); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request.Form["name"]; string url = context.Request.Form["url"]; string domainip = context.Session["domainip"].ToString(); string domainname = context.Session["domainname"].ToString(); string username = context.Session["username"].ToString(); string password = context.Session["password"].ToString(); string dc = context.Session["dc"].ToString(); Operate op = new Operate(domainname, domainip, username, password, dc); DomainUser user = new DomainUser(); user = op.getuserinfo(url, name); JObject json = JObject.FromObject(user); context.Response.Write(json); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string domainname = context.Request.Form["domainname"]; string domainip = context.Request.Form["domainip"]; string username = context.Request.Form["user"]; string password = context.Request.Form["pwd"]; if (domainname != "" && domainip != "" && username != "" && password != "") { string[] array = domainname.Split('.'); string name = array[0]; //域名前缀 Domain prefix string dc = array[1]; //域名后缀 Domain suffix Operate op = new Operate(name, domainip, username, password, dc); if (op.Verification()) { //在这里验证连接并将正确的连接参数记录到Session中 //Verify the connection here and record the correct connection parameters into Session context.Session["domainip"] = domainip; context.Session["domainname"] = name; context.Session["username"] = username; context.Session["password"] = password; context.Session["dc"] = dc; context.Response.Redirect("ListIndex.html", false); } else { context.Response.Write("<script language=javascript>alert('Login error!Check the input information!');window.location='Login.html'</script>"); } } else { context.Response.Write("<script language=javascript>alert('Information can not be empty!');window.location='Login.html'</script>"); } }