When using Visual Studio 2008 or 2010, every time you attach to IIS w3wp.exe you get the Attach Security Warning:
How do you turn this of?
It would be cool to know also, how to keep it attached for longer, as this seems to time out after a while.
Also, I’ve tried the Microsoft Docs page Security Warning: Attaching to a process owned by an untrusted user can be dangerous, but it didn’t work

Also found in the article mentioned by Tzury, but to sum up the answers in this thread:
Make sure Visual Studio is not running when changing the registry key or it will be overwritten on exit with the old value
Visual Studio 2022: Follow these instructions, then reboot.
Visual Studio 2019: Follow these instructions, then reboot.
For older versions of Visual Studio:
Change (or create) the following registry key to 1:
Visual Studio 2008
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger\DisableAttachSecurityWarningVisual Studio 2010
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger\DisableAttachSecurityWarningVisual Studio 2012
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Debugger\DisableAttachSecurityWarningVisual Studio 2013
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Debugger\DisableAttachSecurityWarningVisual Studio 2015
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger\DisableAttachSecurityWarningFor VS2015, you might need to create the Registry Key referenced above.
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger, right-click and create a newDWORD:DisableAttachSecurityWarning1.Update: If you don’t want to open up regedit, save this gist as a *.reg file and run it (imports the keys for all VS versions lower than VS2017).
Visual Studio 2017
The configuration is saved in a private registry location, see this answer: https://stackoverflow.com/a/41122603/67910
For VS 2017+, save this gist as a *.ps1 file and run it as admin, or copy and paste the following code in a ps1 file: