.NET ASPx Sayfası Üzerinden Active Directory’de Kullanıcı Oluşturma Default.aspx

Sistem Admin olarak ihtiyacima yönelik bir proje yapmak istedim ve kollari sıvadım, Active Directory üzerinden kullanıcı ve kullanıcının home dizinini oluşturan bir sayfa kodladım.

Kaynak kodlarını paylasmaktan büyük zevk duyarım sorularınızı mail yolu ile de iletebilirsiniz.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Debug="true"%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ISMC Portal</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge"
    <link href="style/bootstrap.css" rel="stylesheet" />
    <link href="style/bootstrap.min.css" rel="stylesheet" />
    <link href="style/style.css" rel="stylesheet" />
    <script src="scripts/jquery-3.1.1.min.js"></script>
    <script src="scripts/bootstrap.js"></script>
    <script src="scripts/bootstrap.min.js"></script>        
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
    <div class="container">
            <div class="header">
                <nav class="navbar navbar-static-top">
                    <h3><span>Information System Management</span> Portal</h3>
                </nav>
            </div>
            <div class="row">
                <div class="col-md-2 sidebar">
                    <ul class="nav nav-pills nav-stacked">
                        <li><a data-toggle="pill" href="#usercreate">USER CREATE</a></li>
                    </ul>
                </div>
                <div class="content col-md-9">
                    <div class="tab-content">                        
                        <%--User Create--%>
                        <div id="usercreate" class="tab-pane fade">                            
                             <fieldset>
                            <!-- Form Name -->
                            <legend><center>Active Directory User Create Form<br> </br></center></legend>                            
                            <!-- Text input-->
                            <div class="form-group">                               
                              <label class="col-md-4 control-label" for="firstname">First Name</label>  
                              <div class="col-md-5">
                              <asp:TextBox ID="firstname" name="firstname" runat="server" placeholder="First Name" class="form-control input-md" required=""></asp:TextBox>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="lastname">Last Name</label>  
                              <div class="col-md-5">
                              <asp:Textbox id="lastname" name="lastname" runat="server" placeholder="Last Name" class="form-control input-md" required=""></asp:Textbox>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Select Basic -->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="selectrank">Rank</label>
                              <div class="col-md-2">
                                <asp:DropDownList id="selectrank" runat="server" name="selectrank" class="form-control">
                                  <asp:ListItem value="Jr"></asp:ListItem>
                                  <asp:ListItem value="Sr"></asp:ListItem>
                                  <asp:ListItem value="Manager"></asp:ListItem>
                                </asp:DropDownList>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="jobtitle">Job Title</label>  
                              <div class="col-md-5">
                              <asp:Textbox id="jobtitle" name="jobtitle" runat="server" placeholder="Job Title" class="form-control input-md" required=""></asp:Textbox>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Select Basic -->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="office">Office</label>
                              <div class="col-md-5">
                                <asp:DropDownList id="office" runat="server" name="office" class="form-control">
                                  <asp:ListItem value="A Building Basement"></asp:ListItem>
                                  <asp:ListItem value="A Building Ground"></asp:ListItem>
                                  <asp:ListItem value="A Building 1. Floor"></asp:ListItem>
                                </asp:DropDownList>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="phonenumber">Phone Number</label>  
                              <div class="col-md-4">
                              <asp:Textbox id="phonenumber" name="phonenumber" runat="server" placeholder="EXT-***" class="form-control input-md" required=""></asp:Textbox>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Select Basic-->
                               <div class="form-group">
                              <label class="col-md-4 control-label" for="department">Department</label>
                              <div class="col-md-2">
                                <asp:DropDownList ID="department" runat="server" name="department" class="form-control">
								<asp:ListItem value="Bilgiislem" text="Bilgi Islem"></asp:ListItem>
								<asp:ListItem value="Ik" text="Insan Kaynaklari"></asp:ListItem>
								<asp:ListItem value="Maliye" text="Maliye"></asp:ListItem>
                                </asp:DropDownList>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Text input--> 
                            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                            <ContentTemplate>                                                         
                            <div class="form-group">                            
                              <label class="col-md-4 control-label" for="username">Expire Date</label>                                
                              <div class="col-md">
                              <div class="col-md-4">
                              <asp:TextBox ID="TextBox1" name="TextBox1" runat="server" class="form-control col-md-2" required=""></asp:TextBox>
                              </div>                              
                              <asp:Calendar ID="Calendar1" runat="server" Visible="true" OnSelectionChanged="show_calender"></asp:Calendar>                               
                               </div>                                                              
                            </div> 
                            </ContentTemplate>
                            </asp:UpdatePanel>                            
                            <br> </br>
                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="username">User Name</label>  
                              <div class="col-md-4">
                              <asp:Textbox id="username1" name="username1" runat="server" placeholder="User Name" class="form-control input-md-4" required=""></asp:Textbox>
                              </div>
                            </div>
                            <br> </br>                                                  
                            <!-- Password input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="password">Password</label>
                              <div class="col-md-5">
                                <asp:Textbox id="password" name="password" type="password" runat="server" placeholder="Password" class="form-control input-md" required=""></asp:Textbox>
                                <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Password does not match!" ControlToCompare="password" ControlToValidate="password1" Font-Bold="True" Font-Size="Medium"></asp:CompareValidator>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Password input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="password1">Re-Password</label>
                              <div class=col-md>
                              <div class="col-md-5">
                                <asp:Textbox id="password1" name="password1" type="password" runat="server" placeholder="Password" class="form-control input-md" required=""></asp:Textbox>
                                 
                              </div>
                              <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Password is not strong!" Font-Size="Medium" Font-Bold="True" ControlToValidate="password" ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,16})$"></asp:RegularExpressionValidator>
                              </div>
                            </div>
                            <br> </br>
                            <!-- Button --> 
                            <fieldset>
                                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                    <ContentTemplate>
                                        <div class="form-group">
                                        <label class="col-md-4 control-label" for="button1">Create User</label>
                                        <div class="col-md-4">                               
                                        <asp:Button id="button1" name="button1" class="btn btn-primary" runat="server" Text="User Create" onclick="button1_Click"/>
                                        <asp:Button id="button2" name="button2" class="btn btn-primary" runat="server" Text="User Home Folder Create" OnClick="button2_Click" TabIndex="1" /> 
                                        <asp:Label ID="label1" Font-Names="label1" />                                                           
                                        </div>
                                        </div>         
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </fieldset>                             
                            <br> </br>                                                        
                           <!-- Listbox input-->
                            <fieldset>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                            <div class="form-group">
                              <label class="col-md-2 control-label" for="groupnames">Groups</label>
                              <div class="col-md-6">   
                              <div class="list-group col-md-8">                            
                             <asp:ListBox ID="ListBox1" runat="server" Height="400px" Width="400px" CssClass="form-control">                                   
									<asp:ListItem Value="security3" Text="BILGI-ISLEM SEC"></asp:ListItem>
									<asp:ListItem Value="distribution7" Text="BILGI ISLEM DIST ALL"></asp:ListItem>
									<asp:ListItem Value="distribution8" Text="BILGI ISLEM YAZILIM DIST"></asp:ListItem>
									<asp:ListItem  Text="----------------------------------"></asp:ListItem>
									<asp:ListItem Value="security4" Text="MALIYE SEC"></asp:ListItem>
									<asp:ListItem Value="security5" Text="IK SEC"></asp:ListItem>
									<asp:ListItem Value="distribution12" Text="MALIYE ALL PERSONNEL"></asp:ListItem>
									<asp:ListItem Value="distribution13" Text="IK ALL PERSONNEL"></asp:ListItem>
									<asp:ListItem  Text="----------------------------------"></asp:ListItem>                           
							</asp:ListBox>                        
                            <asp:Button ID="ekle" runat="server" Text="Ekle" CssClass="btn btn-primary" OnClick="ekle_Click" />
                            <asp:Button ID="cikar" runat="server" Text="Cikar" CssClass="btn btn-primary" OnClick="cikar_Click" />                                             
                             </div>
                              <div class="list-group col-md-4">
                                    <asp:ListBox ID="ListBox2" runat="server" Height="400px" Width="400px" CssClass="form-control">                                                                                                  
                             </asp:ListBox>
                               </div>                             
                             </div>                                                           
                            </div> 
                             </ContentTemplate>
                             </asp:UpdatePanel>    
                             </fieldset>
                            </form>
                        </div>                         
                        </div>
                    </div>
                </div>                
            </div>
        </div>
    </form>
</body>
</html>

Erdem AYYILDIZ
ayyildizrdm@gmail.com

About the Author

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir