0
votes
1answer
100 views

Security Validation Error

I'm trying to create a spweb in page_load via a control on the site. I get the error "The security validation for this page is invalid". I've got a postback (No GET-Request) and also tried ...
2
votes
2answers
410 views

How to check username/accountname under which the code runs?

We want piece of code which we can paste in the code behind and get the username under which code runs for:- (usually .NET code runs under account of application pool) Timer job. Event receiver. ...
0
votes
1answer
122 views

Can SPPersistedObject settings be updated by normal users if ran with elevated privileges?

I have a custom ribbon icon "Enlist" deployed to each document library. A normal (i.e. non-admin) user can click this icon; when he does, I would like to permanently save the document library ...
2
votes
2answers
132 views

Under what permissions/priviledge does the runwithelevatedprivileges code run?

SPSecurity.RunWithElevatedPrivileges Method Executes the specified method with Full Control rights even if the user does not otherwise have Full Control. 1) But which under which account does this ...
0
votes
1answer
67 views

Conditional SPSecurity.RunWithElevatedPrivileges

Is there a way to use SPSecurity.RunWithElevatedPrivileges conditionally. For example, assume that i have a code block, if some condition is met i want to run this code block in ...
1
vote
1answer
396 views

Get list items even if user does not have access to those items

Is there a way to get items from a list even if the current user does not actually have acces to them? SPSecurity.RunWithElevatedPrivileges does not seem to work! I have a special case in which I ...
3
votes
1answer
301 views

RunWithElevatedPrivileges doesn't work in Webpart Constructor

With Sharepoint 2007 I am using RunWithElevatedPrivileges to write to the Event Log, but if I place the call inside the Webpart constructor, I get a "Request Failed" message. However, if I put this ...
6
votes
5answers
1k views

How to detect if my code is running inside SPSecurity.RunWithElevatedPrivileges

Is there a way to detect if my code is running inside SPSecurity.RunWithElevatedPrivileges? class Foo { public static void Bar() { if (CODE_RUNS_ELEVATED) { Debug.WriteLine("You ...
10
votes
3answers
3k views

Best way to Impersonate in SharePoint

So far, I am aware of below 3 ways of performing impersonation in a SharePoint web part or page : Using Win32 API [DllImport("advapi32.dll", SetLastError=true)] public static extern bool ...
3
votes
3answers
1k views

SPSecurity.RunWithElevatedPrivileges that elevates outside of the current web application context

Im not sure if this is possible without impersonating a user/service account (and therefore hard coding credentials) that has farm level access... The situation is I want to access an SPSite in ...