I am using SharePiont Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5. I am wondering whether SharePoint has any means to set current user to be some specific user? For example, I want to set the user to be administrator automatically when people connects from a specific IP address to grant such people high privilege. Another example is when people connects my sie using special connection string, like http://example.org/default.aspx?specialtestuser=foo, then I will set current user to be foo. Appreciate if any code samples to reference?
In Sharepoint you can use impersonation to execute code in place of a specific user. You can also use this technique to run some section of your code with higher priviledge (better than giving full high priviledge to a user). Here just 2 links but if you search the net for Sharepoint and Impersonation you will find more links.
MSDN on impersonation and other tricks
Impersonation in Sharepoint 2007
I hope this will help
Here another link that propose to set up some HTTP module and that looks a little like you want to do : siteminder and sharepoint 2007
But I never tried this out so I can't help you much more.