Access denied after clicking save




I'm getting a "access denied" error when I click on the save button after clicking to edit a user. Creating and deleting works fine. I'm running the app with RequireSiteAdministrator set to false.

Any ideas?



I think the problem is that updating another person's SPUser object probably requires more permissions than the user has, if they're not an administrator.  Try updating the code to run with elevated privileges (SPSecurity.RunWithElevatedPrivileges).


Does not seem to work :(


In that case i'd probably do a debug on it to find out the exact line causing the access denied, which will hopefully give you a clue as to the problem.  But it's probably a permissions issue.  Also, make sure that the SPSecurity.RunWithElevatedPrivileges is being used properly - you can't use SPContext.Current with it.  You can look at MembershipRequest.cs for an example.


The error is thrown at "spuser.Update();" in UserEdit.aspx.cs.

I've tried this:
SPSecurity.RunWithElevatedPrivileges(delegate() {

But it does not work but then again I'm not a real developer :)


That's not going to work because spuser has to be defined within RunWithElevatedPrivileges - check MembershipRequest.cs for examples.  If you do need one on one help and custom code modifications, we do offer that with our support plan. Check