Based on your input I have done the following code:

public class FileUnblocker {
    [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static extern bool DeleteFile(string name);

    public bool Unblock(string fileName) {
        return DeleteFile(fileName + ":Zone.Identifier");
    }
}

Thanks to Stuart Dunkeld, Alex K(+1) and Sven to show me the direction.

UPDATE I have posted the code here for a feedback if it would work reliable in production environment. If someone want to use it, check out there.


It's stored in the :Zone.Identifier stream (more < c:\theapp.exe:Zone.Identifier) you need to use the native IO routines to manipulate them, here is a managed wrapper.


The official way to manage this identifier is with the PersistentZoneIdentifier COM object: http://msdn.microsoft.com/en-us/library/ms537029(v=vs.85).aspx