Ir al contenido principal

Entradas

Mostrando entradas de octubre, 2015

C# Upload files

How to upload files to a server In the ASPX  <% using (Html.BeginForm(" UploadFile ", " AccessRequestProvider ",                     FormMethod.Post, new { enctype = "multipart/form-data" })) {%> Where  UploadFile  is the method and  AccessRequestProvider  is the controller (.cs) Then include the fields to upload the files  <input type="file" name="files" id="file1" class="filestyle" data-classbutton="btn btn-primary" data-input="false" data-classicon="icon-plus" data-buttontext="TEst.">                                                               <input type="file" name="files" id="file2" class="filestyle" data-buttonname="btn-primary" data-buttontext=" TEst."> Close the form  <%}  %> ...

C# - Connection to Active Directory

How create a connection to AD? Include in the References Define the variables server = company.se container = DC=compan,DC=se Create the connection              PrincipalContext pc = new PrincipalContext(ContextType.Domain, server, container);             DirectorySearcher directorySearcher = new DirectorySearcher(pc.ConnectedServer);             directorySearcher.Filter = "(sAMAccountName=" + signum + ")";             SearchResult results = directorySearcher.FindOne();             DataTable dtDomain = new DataTable("DomainP"); Parse the result if (results != null)             {                 dtDomain.Columns.Add("displayname");                 dtDomain.Columns.Add("departmen...