10 Feb 2015

Edit Web.Config from File Explorer in Windows 7 / 8 / 2012 - Read Only for Administrator

Don't you hate that UAC thing whereby you can't edit your site's web.config file directly from File Explorer? It lets you open it in notepad and then won't let you save. Even though you're an Administrator! ANNOYING!

It's because of the default Access Control List on the Inetpub folder. When you edit any file under that folder, Windows busts you down to User level permissions, even though your user is a member of the Administrators group.

A quick fix is to grant full access permissions over Inetpub to your explicit user account. Run this in an elevated (Run As Administrator) command prompt (Note you don't need to type your actual username in here, the environment variables will be interpolated for you automatically):

icacls %systemdrive%\inetpub /grant  %userdomain%\%username%:(OI)(CI)(F) /grant %userdomain%\%username%:F

No comments:

Post a Comment

Comments are very welcome but are moderated to prevent spam.

If I helped you out today, you can buy me a beer below. Cheers!