Click here to Skip to main content
15,890,512 members
Everything / Directory

Directory

directory

Great Reads

by Bohdan Stupak
Batching is a nice technique that allows you to handle big amounts of data gracefully. Directory.EnumerateFiles is the API that allows you to organize batch processing for the directory with a large number of files.
by Habibur Rony
This article mainly covers how to setup and configure Azure AD tenant and integrating Azure AD into ASP.NET Core 2.0 web app for authentication and role based authorization.
by Abhijit Shiposkar
Accessing Active Directory Objects via C# (Visual Studio)
by Gil Fink
This tip explains how to perform queries against Active Directory Domain Services

Latest Articles

by Bohdan Stupak
Batching is a nice technique that allows you to handle big amounts of data gracefully. Directory.EnumerateFiles is the API that allows you to organize batch processing for the directory with a large number of files.
by Habibur Rony
This article mainly covers how to setup and configure Azure AD tenant and integrating Azure AD into ASP.NET Core 2.0 web app for authentication and role based authorization.
by Sundeep Kamath
How Resources in Azure can be accessed programmatically using Azure Resource Manager (ARM) APIs
by Sandeep S. Sandhu
Deploy Kerberos on a Raspberry Pi IoT to provide robust and enterprise scalable authentication for IoTs (Part 2)

All Articles

Sort by Title

Directory 

16 Jul 2017 by RealFlare
Is it possible to code an application that creates a folder in the temp directory, and then moves the application to the folder? Or that when the application executes, it is saved in the folder? What I have tried: If Not Directory.Exists(folder_name) Then ...
16 Jul 2017 by Dave Kreskowiak
Sure, it's possible to create a folder in one of the Temp folders. Moving the application? Why? There's no reason to do that. Also, if your app is installed under Program Files, which it should always be, normal users do not have permissions to MOVE the application files to another folder....
6 Oct 2015 by Sergey Alexandrovich Kryukov
There is no such thing as "navigation", in this context. If you mean the change of current directory inside the application, just don't provide code changing it. Isn't it simple.The general idea is however abusive. Generally speaking, you should not limit the user's navigation, if there is...
17 Jul 2017 by Richard MacCutchan
Please stop reposting this question. You have received a number of suggestions already. If you really cannot solve such a basic issue then you should go back to your study guides and do some serious reading.
24 Jul 2011 by Prerak Patel
You need to use NetworkCredential[^].
24 Jul 2011 by KhanImranKhan
Hello MembersHow to search files in a password procteced folder on a remote machine ? I've the server IP and userid/password to access the folder but how to authenticate programmatically.Thanks
25 Jul 2011 by Dave Kreskowiak
That depends on the server you're talking about and how you have to access it. You kind of left those little, but very important details, out of your question.
6 Dec 2016 by Sundeep Kamath
How Resources in Azure can be accessed programmatically using Azure Resource Manager (ARM) APIs
9 Feb 2011 by Abhijit Shiposkar
Accessing Active Directory Objects via C# (Visual Studio)
22 Feb 2011 by Member 3568076
Hi,How to list all users in ListBox include cn, mobile, mail?private void Form1_Load(object sender, EventArgs e){ DirectoryEntry dir = new DirectoryEntry("LDAP://ou=o,DC=xyz,DC=de"); DirectorySearcher search = new DirectorySearcher(dir); search.Filter =...
20 Apr 2012 by xiaolixx
Hi im trying to write a web interface to access Active directory shares through LDAP / Active Directory Application Mode. I cant even find out if the shares are stored in Active directory or on the server in windows itself, any help would be greatly appreciated. If the shares are stored in...
9 Jan 2016 by Snorri Kristjansson
Active Directory change auditing solution. A Windows Service that stores selected AD change events from the Security log of all Domain Controllers to an SQL database.
22 Mar 2010 by silentdeepa
Hi,I need to access Active Directory that resides on Windows 2003 server from an ASPX application that is hosted on another Windows 2003 server. I code works fine if both the Active Directory and ASPX application are on same server. But I get "The server is not operational" error when...
24 Mar 2010 by RCoate
Have you tried serverless binding?Instead of:silentdeepa wrote:LDAP://FullyQualifiedServerName/OU=Users, OU=NPP,DC=example,DC=myserver,DC=inUse:LDAP://domain.com/DC=domain,DC=com,OU=Users,OU=NPP,DC=example,DC=myserver,DC=in(you may also need to put in...
15 Jun 2015 by Hamza Dweikat
Hi All ,I am working to develop an asp.net web forms that working on the active directory authentication . we need to make a mix mode of form authentication and windows authentication togetheris there is any special configuration for IIS is this possible to do? Thanks
15 Jun 2015 by ZurdoDev
Mixed authentication is relatively easy to do. I do suggest searching for examples. I'll briefly explain what I did about 5 years ago.1. Set your web.config to use Forms Authentication. https://msdn.microsoft.com/en-us/library/7t6b43z4(v=vs.140).aspx[^]2. Set the login url to a page...
25 Mar 2013 by SHAJANCHERIAN
one of Our client need a date-wise list of Number of users locked out.Eg.Date locked outNumber of users locked outTotal attempt made by all user after12-Jan-13 3 users 30 attempts10-Jan-13 3 users 30 attempts For this we need to get the history of the...
19 Aug 2014 by Jinan Kordab
This article describes how to create or delete an Active Directory Services Email using ASP.NET web page, remotely.
29 Jan 2012 by pradip_ssd
HI I am currently working in active directory . I have one computer connected to theactive directory . I am able to get the user connected to that Computer but not able to get the last account modify date of a particular user account.Please help.Thanks in Advance
29 Jan 2012 by Rajesh Anuhya
Go through the below linksHowto: (Almost) Everything In Active Directory via C#[^]Here[^]Thanks--RA
18 Feb 2010 by Mehul M Thakkar
Hi,I need to develop web base extranet(internet) application with Active Directory. Is there any way to avoid login screen in application with the use of SSO with Active Directory?I read about to implement in intranet application with windows authentication. That is fine because the...
19 Feb 2010 by Alaric Dailey
Theoretically its possible, you could connect over an exposed port (preferably over SSL) to query it. But there are better solutions out there.OpenID, OAuth, and WCF authenticationDotNetOpenAuth implements OpenID and OAuth for .NET
20 Jun 2011 by mfinky
Hi.Is there any way to retrieve the date-time when a specific user joined a specific AD group?Thanks,Marcelo
20 Jun 2011 by dasblinkenlight
I do not think that there is a direct way to get to this information. We used to work around this problem by participating in AD's RPC Replication, and storing the history in the database. Essentially, our program periodically polled the actual AD for the "deltas", filtered out the changes that...
21 Oct 2015 by Member 11999641
hi all, I have created new directory and wanted to save chart image in this new created directory, how can I do this?This is my code:if (!Directory.Exists(@"C:\Users\user\Desktop\Project\Project1\Test\Test\NewProject\StoreImage\" + panel.HeaderText)) { ...
21 Oct 2015 by OriginalGriff
Try:string basePath = Path.Combine(@"C:\Users\user\Desktop\Project\Project1\Test\Test\NewProject\StoreImage, panel.HeaderText);if (!Directory.Exists(basePath) { Directory.CreateDirectory(basePath); }MyImageOfAChart.Save(path.Combine(basePath, "MyFileName.jpg"),...
3 May 2010 by alessandro.campagna
Hi All, I got a Login page, using the .net login control that work correctly on my intranet network.
3 May 2010 by Michel Godfroid
Do you want to pre-fill your domain field with all available domains? This will require walking the trust chain in AD, starting from the domain in which the server is a member. This may be complicated. You could also query the dns chain for _mscds records, but this sounds iffy, and if it works,...
21 May 2013 by _Amy
Validating the client using Lightweight Directory Access Protocol (LDAP)
30 Aug 2018 by KD209
Hello All, I am trying to create a PS Script that will search AD account with the following conditions: Account is Active/Enabled (account not disabled) Account is expired 90 days or more Account password is not set to never expire or Account password has expired I want the result to return...
21 Sep 2018 by Richard Deeming
Try PasswordLastSet instead of PwdLastSet. As far as I can see, there isn't a PwdAge property; you'll need to calculate it from the PasswordLastSet property. Something like this should work: Search-ADAccount -AccountInactive -TimeSpan 90 -UsersOnly -SearchBase "OU=User...
1 Aug 2018 by Habibur Rony
This article mainly covers how to setup and configure Azure AD tenant and integrating Azure AD into ASP.NET Core 2.0 web app for authentication and role based authorization.
12 Aug 2023 by Bohdan Stupak
Batching is a nice technique that allows you to handle big amounts of data gracefully. Directory.EnumerateFiles is the API that allows you to organize batch processing for the directory with a large number of files.
15 Aug 2016 by David Dimalanta
I tried using this[^] tutorial from the App Guruz website to observe and point out the errors on not showing the leaderboard UI. Not only the codes but also the plugins as well. (see this link[^] below for more info) By the way, i'm using Unity, making games. After I succeeded in showing...
9 Oct 2011 by Fazlur Rahman
This article describes how to keep form based and active directory user based authentication process in parallel in ASP.NET.
12 Dec 2014 by Member 10587827
Hey guys,Now i want to ask you someting about creating directory. I know how to create dir with names that i write in my code but i want to create directory that name is date of today. Here is my code; DateTime now1 = new DateTime(); now1 = DateTime.Today; ...
12 Dec 2014 by Praveen Kumar Upadhyay
You should use the following code to combine strings into a pathcolorPath = System.IO.Path.Combine(@"c:\data\", bugun);The Combine method takes care of adding or removing backslashes where necessary.DateTime.Today returning date which contains '/',spaces and/or special character....
12 Dec 2014 by TheRealSteveJudge
If you use a debugger it says: The given path's format is not supported.bugun is 12.12.2014 00:00:00So you are trying to create a path called c:\data\12.12.2014 00:00:00':' is not allowed in a path name.Change the format of your date e.g.:string bugun =...
12 Dec 2014 by Mr. Mahesh Patel
string bugun = DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(@"c:\data\" + bugun)){ Directory.CreateDirectory(@"c:\data\" + bugun);}
26 Jun 2012 by solsystem
Please help! I just want to get the total size of a directory and display that size in a progress bar with a limit of 700mb. Everytime you add an .mp3 file to my listbox, the files are automatically converted to .wav, added to the list, and then I want the progress bar to represent the file...
26 Jun 2012 by Clifford Nelson
You can get the directory size with linq:string path1 = @"C:\Users\cnelson\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2";var dir = new DirectoryInfo(path1);long totalsize = dir.GetFiles().Sum(file => file.Length);or do it the old way:string...
24 Oct 2010 by Richard MacCutchan
I have tried to re-create your problem on Windows 7, and am able to create a new directory, add a file to that directory, and write data into that file. Windows explorer shows the directory as read only but I suspect that this is not absolutely correct. You state that you get crashes in your...
24 Oct 2010 by Nish Nishant
A directory is always treated as read-only (internally it's sorta like a read-only file entry if you think of it). As Richard hinted already, your error is somewhere else.
23 Oct 2010 by DreamCpp
I am working on a project that involves parsing a bunch of xml files in a customizable folder.For sake of saving you several hundred lines of code...Im using MFC on windows XP to build a dialog app, CString is my primary means of storing string data, all global app settings are in a static...
21 Aug 2018 by Member 10521346
I have a windows server 2012 R2 which not in AD Server. I have a user "TestUser" on server which can not change its own password. So, I need login as administrator to reset "TestUser" password. I tried the codes below, but got access denied error. How can I change "TestUser" password? What I...
9 Aug 2012 by vinjamuri_venkat
when i am try to change password to an active directory user using the following code i am getting the the exception//string OldPassword, string NewPassword)try { entry.Invoke("ChangePassword", object[] password); entry.CommitChanges(); ...
9 Aug 2012 by Eddy Vluggen
There's a list of exceptions that can be thrown in the documentation[^], including their reasons. I suggest you also read the notes below the exceptions, as this would require a specific set-up.
25 May 2011 by swbo102
I am using system.directoryservices.accountmanagement in C# to update fields in active directory and what I need to do within this namespace is to move a user from one Organizational Unit to another. I know how to add and remove a user from a group, but I haven't been able to find how to move...
25 May 2011 by Marc A. Brown
Does this[^] article help? There's a bit in there about moving an object from one location to another that might be of interest.
12 Mar 2015 by Çağrı Daşkın
Hello all,I want to install my program on another computer. My aim is saving an image to a file for using later. But the image isn't being saved. image.Save(Application.StartupPath + "\\" + "data" + "\\" + "config" + "\\" + "Choosen.bmp");(Application.StartupPath = C:\Program...
12 Mar 2015 by OriginalGriff
No, the image won't save.When you install an application in production, it is installed in a folder below the "Program Files" or "Program Files (x86)" folded - and by default these folders are all write protected to help reduce the impact of Trojans, viruses, and so forth.So when you try...
12 Mar 2013 by rammohan004
Hi,I am trying to create an application in c# which can copy a complete directory and stores it in that application only so that when i move that application from one system to another, the copied directory comes along with the application and i will should be able to deploy or paste that...
9 Mar 2021 by Member 14864964
Hi I have the following path : Z:\logs\computername\username I would like to check if all files within "username" are over 30 days old and if so delete the computername folder too (not only username subfolder). Using forfiles I can delete...
9 Mar 2021 by Richard MacCutchan
You may like to look at Use Windows PowerShell to search for files | Scripting Blog[^]. Although it is PowerShell it could be used to create the list that you need. This script will get you a count of all files more than 30 days old. ...
24 Nov 2021 by LNogueira
Hi,I'm receiving the following error when the computer object has child objects.Unable to delete object:The directory service can perform the requested operation only on a leaf object.My code:Shared Function DeleteMachine(ByVal adPath As String, ByVal domain As String) As...
9 May 2012 by Maciej Los
I have found interesting example on http://stackoverflow.com/questions/7910534/how-to-delete-computer-account-from-active-directory-using-c-sharp[^]The difference is in DeleteTree[^] method for DirectoryEntry, not Delete() for ComputerPrincipal.Here[^] is a little more about "Container...
25 Mar 2011 by Pascal Ganaye
Deleting protected folders in Windows 7
15 Sep 2013 by Member 10263493
Good morning,is there anyone to knows how detect when the user opens a folder?thanks
15 Sep 2013 by TheUltimateDebugger
Check the discussionDetecting an opening folder on C#[^]
15 Jun 2012 by mrmarzban
Directory & file.what is the difference between directory and file? ;what does directory do? ;why do we use directory? ;what makes directory class special? ;is there any other way to do what directory class does without using it? ;what are abilities of directory? ;
15 Jun 2012 by OriginalGriff
The Directory and File objects are different because the targets they describe are different. A Directory refers to a disk directory (or similar) which contains a collection of Files.If you like, think of a Directory as a special type of file which tells you where to go to get to each file....
24 Mar 2013 by rammohan004
HI,I am trying to create a windows application with which i can transfer the whole directory from a perticular path to another system over the lan. Suppose in System1 i have a folder in D:\ABC containing few subfolders and file, i want to transfer this directory to System2 in the same place...
25 Mar 2013 by RajeshRaushan
It won't be possible that way. However if you have a shared folder with write permission on the 2nd system then inside that folder you can create sub-folder very much same way as you do in local system. You will need to provide the shared path that is in the format:...
11 Oct 2013 by ASP.NET Community
ASP.NET 2.0 uses a new set of predefind Directory names for special work. In general, the ASP.NET directory structure can be determined by the
16 Aug 2013 by gayanee Wijayasekara
i have a web site developed with c#. this site will be hosted in the local intranet of our organization. the users are authenticated from their windows ID using windows authentication. i want to display the picture in the active directory of a user, when a user visits the site.please...
16 Aug 2013 by fjdiewornncalwe
You can try the solution found hereor you can browse through some of the other links here
16 Jun 2014 by Member 10337777
using System;using System.DirectoryServices;using System.Collections;using System.IO;public class ADPhoto {public void Set() { try { var de = new DirectoryEntry("LDAP://cn=username,cn=users,DC=domain, DC=com"); de.Username = "username"; de.Password = "password";...
11 Oct 2013 by ASP.NET Community
This is how to to list the files in a specific directory and allow the user to download the files.ASPX:
5 Oct 2016 by Sandeep S. Sandhu
Deploy Kerberos on a Raspberry Pi IoT to provide robust and enterprise scalable authentication for IoTs (Part 2)
21 Jul 2014 by Brad Joss
Search for files and folders and don't exit the search when there is an error accessing a protected folder, just skip it.
22 Oct 2012 by Alchemist2889
Hello Everyone,I installed ADFS 2.0 on my machine (Windows Server R2 SP1) but I wasn't able to start the ADFS service due to some issues (its an entirely different topic). I tried to uninstall it and then install it again, For uninstalling I used the process provided at this link...
7 Oct 2012 by Mayur2258
Hi All,I am working on XML files. I have created small XML tool which returns number of specific tag repeated in all files.This code runs properly to find the numbers of tag present in files within specific folder mean there should not be any other folder in XML files containing folder....
27 Oct 2021 by Member 14925860
I am comparing all files in two directories, if comparison is greater than 90% so i continue the outer loop and i want to remove the file in the second directory that was matched so that the second file in the first directory doesn't compare with...
17 Mar 2016 by pmcm
Hi, I have an application that is made up of numerous controls. One of these controls 'BrowseFilesUsrCtrl.ascx' displays with a treeview (displaying all folders/files on the directory) on the left hand side with a preview pane on the right which displays the contents of certain files for read...
25 Apr 2013 by Mike Meinz
You can do it all using the System.IO Classes in the .NET Framework. Upon click on directory name in the left preview pane, use System.IO.FileInfo class to retrieve details of each file found via the Directory.EnumerateFiles method.Some examples that you can learn from:How does...
2 Oct 2013 by PrafullaVedante
Hi,Is ther any function in C++ on windows(win32 or MFC) for 1 ) Creating a directory tree at given path. e.g. if path is c\Test1\Test2\Test3 Then the function should create all directories which does not exist on the disk. I know we can achieve this by tokenizing the path...
2 Oct 2013 by Jochen Arndt
Yes, there is such a function: SHCreateDirectoryEx[^]. To use it you must include shlobj.h and link with shell32.lib.
26 Feb 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
This is a simple trick to find file names of a particular file type existing in a folder.
8 Mar 2011 by Apfelmuuus
I use msbuild to build some projects and have to invoke msdev.exe (Visual Studio 6) to build older projects. Since there is a need to use the msbuild-project on different computers I have to get the installdirectory of Visual Studio 6 each or something else.Thanks in advance for any help.
8 Mar 2011 by Amit Kumar Tiwari
Please try code below:/// /// Gets the Visual Studio 2008 installation directory path. /// /// Visual Studio 2008 installation directory path public static string GetVS9InstallDirectory() { ...
8 Mar 2011 by Apfelmuuus
All right I got it!I just changed.RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS"); vsInstallationPath = regKey.GetValue("ProductDir").ToString();to:RegistryKey regKey =...
8 Mar 2011 by Ryan Zahra
May I add to Amit Kumar Tiwari solution:First you need to check if you're running in x86 or x64. This could be achieved by:System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")Please note that this only works if the variable isn't manipulated!!If the architecture is x86...
7 Nov 2011 by lilyNaz
Hi,I need to get the path of all directories which are opened by the user so that I can get all the files and subdirectories which the user may wnat to open and scan them. Can anybody help?Thanks alot.
7 Nov 2011 by epanjohura
http://www.cplusplus.com/[]
7 Nov 2011 by Andrew Brock
Depending on what you are wanting to do, a shell extension[^] may be the best thing. This will integrate your code directly into Windows Explorer, and allow you to do things such as add a toolbar or a column to the file view.If you just want to know what they are looking at, without changing...
29 May 2013 by amitghorpade29
Hi,I want get all user from particular security group. This Group present in Active directory.I want filter condition for this and also I need C sharp code to do it same.I am trying following Filter criteria:(&(objectCategory=group)(SAMAccountName=" + txtusername.Text +...
29 May 2013 by Orcun Iyigun
Here are some links to help you:C#: Getting members of a group the easy way with .Net 3.5 (Discussion groups, nested, recursive, security groups, etc.)[^]Retrieve all the users in an Active Directory group using C#[^]Good luck,OI
29 May 2013 by tumbledDown2earth
class ActiveDirectory { public ActiveDirectory() { //PrincipalContext insPrincipalContext = new PrincipalContext(ContextType.Machine); //Connecting to local computer. //PrincipalContext insPrincipalContext = new...
13 Feb 2015 by Member 11227881
Hello,I am attempting to get the Get User Division from Active Directory. I am having problem returning the User Division after I get the Get User Group Memberships. I am only looking for the unique group membership to determine what division the User is apart of. Error Message is below the...
13 Feb 2015 by PIEBALDconsult
ArrayList is sooo V1. But why don't you simply do userGroup.Add ( userGroupTemp ) ?
11 Oct 2013 by ASP.NET Community
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and
15 Dec 2011 by Member 3691628
Hi AllI am using windows 2008 R2 Server and trying to Add a user in active directory. I am able to save user ID of length less than 20 Characters. But when I am trying to increase this value to 30 characters then I am getting the error....
11 Mar 2011 by WajihaAhmed
I am working on a project named "file crawler" in visual c++. It will simply index all the files of a specified directory in a file. The user can search this c++ file for a particular file through extension, name etc.Right now, I want to get all the file names and directories into an object...
11 Mar 2011 by Espen Harlinn
I believe you may find this interesting:http://www.boost.org/doc/libs/1_46_0/libs/filesystem/v3/doc/tutorial.html[^] - it will even work on other os'esYou can also usehttp://www.boost.org/doc/libs/1_46_0/libs/regex/doc/html/index.html[^] to facilitate quite advanced search...
24 Mar 2012 by Member 3691628
Hi All,I am using ADFS ,Active Directory and asp.net based relying party application.In my active directory structure there are two OU (customer and CustomerSupport). I am creating a user in customer OU through C# code and using UPN field as user logon name. And Creating same UserId from...
13 Mar 2011 by WajihaAhmed
Hi everyone!I am using the directory class to get this information but unable to assign this data to a data member of my own class, (I am doing an oop project). Furthermore, I want to use the concept of Dynamism(containment).I have created two class, mydirectory and myfiles as under:...
13 Mar 2011 by Hans Dietrich
Check out MSDN for FindFirstFile() and FindNextFile().To open a file, you can use ShellExecute(). This will open any file that has a recognized/associated extension.
13 Mar 2011 by CPallini
programming nerd wrote Directory::GetDirectories("D:\\")This method is for managed code. If you are indeed using CLI/C++ the have a look at the documentation provided code sample: DirectoryInfo.GetDirectories[^].On the other hand, if you're writing native code then check out, as Hans...
14 Mar 2011 by Emilio Garavaglia
In addiction to other solution, consider also a better design of your classes, or your code will became a mess.a) You use sometimes string (did you mean std::string ??) sometime character arrays, sometime char*. Be consistent!b) Directories should form a hierarchy. How can you do it with...
17 Apr 2011 by WajihaAhmed
Finally I completed the short project.To get the list of files and sub directories, I made use of .NET Framework namespace "System".It has got classes like "FileInfo" and "DirectoryInfo"(both belong to System::IO) which do the above required task.But here,all the string related stuff is of...