Retrieve File Security Information using C#

Retrieve File Security Information using C#

Verify if file exists in the directory using the System.IO namespace. And retrieving the security information and other details. This as been demonstrated using the Windows forms application.

if (File.Exists(openFileDialog1.FileName))
//MessageBox.Show("File exists!");
lbl_existstatus.ForeColor = System.Drawing.Color.SeaGreen;
lbl_existstatus.Text = "File Exist the directory";
lbl_existstatus.ForeColor = System.Drawing.Color.Red;
lbl_existstatus.Text = "File Missing in the directory";

Query the secuirty inforamtion of the file using the System.Management.

using (ManagementObject o = new ManagementObject(@"Win32_LogicalFileSecuritySetting.Path='" + fileName + "'"))


Popular posts from this blog

ASP.NET website "Cannot read configuration file due to insufficient permissions" in IIS 7 and Windows Server 2008

Error occurred in deployment step 'Install app for SharePoint': The System Account cannot perform this action.

Windows Server AppFabric: installation error , While installing SharePoint prerequisite installer