How to grant full permission to a file created by my application for ALL users?

Note to people using this. When using literal strings for the FileSystemAccessRule, it should be WellKnownSidType.WorldSid instead of “everyone”. The reason is because there are multiple Window languages and Everyone only applies to EN ones, so for Spanish, it might be “Todos” (or something else). using System.Security.AccessControl; using System.Security.Principal; using System.IO; private void GrantAccess(string fullPath) … Read more

Start / Stop a Windows Service from a non-Administrator user account

Below I have put together everything I learned about Starting/Stopping a Windows Service from a non-Admin user account, if anyone needs to know. Primarily, there are two ways in which to Start / Stop a Windows Service. 1. Directly accessing the service through logon Windows user account. 2. Accessing the service through IIS using Network … Read more

What are all the user accounts for IIS/ASP.NET and how do they differ?

This is a very good question and sadly many developers don’t ask enough questions about IIS/ASP.NET security in the context of being a web developer and setting up IIS. So here goes…. To cover the identities listed: IIS_IUSRS: This is analogous to the old IIS6 IIS_WPG group. It’s a built-in group with it’s security configured … Read more

Creating and managing a Facebook app from a Business Account [closed]

‘Business’ or advertising accounts can’t manage apps – if at some point in the past you were able to create an app using a business account this was a bug or loophole and shouldn’t have been possible – only real verified user accounts should be able to create and manage apps. It’s also possible to … Read more

Detect if running as Administrator with or without elevated privileges?

Try this out: using Microsoft.Win32; using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Security.Principal; public static class UacHelper { private const string uacRegistryKey = “Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System”; private const string uacRegistryValue = “EnableLUA”; private static uint STANDARD_RIGHTS_READ = 0x00020000; private static uint TOKEN_QUERY = 0x0008; private static uint TOKEN_READ = (STANDARD_RIGHTS_READ | TOKEN_QUERY); [DllImport(“advapi32.dll”, SetLastError = true)] [return: … Read more