Thursday, February 20, 2014

LoadUserProfile Function Error - Returning Value 1314

I came across this error while trying to Debug-Run a C# ASP.Net web app in Visual Studio 2010.

PROBLEM:
Calling LoadUserProfile returns an error value of 1314 while attempting to impersonate a windows user programmatically.


CAUSE:
Permissions, or rather:
"The calling processes must have SE_RESTORE_NAME and SE_BACKUP_NAME privileges" - http://msdn.microsoft.com/en-us/library/bb762281%28VS.85%29.aspx


SOLUTION
Run Visual Studio as Administrator.
A simple one after about an hour of trouble shooting, right-click on the VS icon and choose Run As Administrator.

SOURCE
http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/b9ea2a0e-5a0e-4e07-92e2-4c7e1f2c5496/loaduserprofile-returning-value-1314-errorprivilegenotheld?forum=windowssecurity