As the question says, when you deploy a webpart and access it from sharepoint, it runs in current user identity or app pool ?

2 Answers 2


Any code in the web part will run in the context of the current user unless it has blocks where privileges have been elevated. This is commonly done using SPSecurity.RunWithElevatedPrivileges which runs code in the context of the App Pool account. The constructor of the SPSite object in the SharePoint Server Object Model also enables you to run code in the context of a specific user by passing a SPUserToken as a parameter.

See these blog posts for more information.

Best Practices for Elevated Privilege in SharePoint

Elevated Privilege with SPSite


It runs as the app pool identity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.