Impersonation in code/Sharepoint

  • Thread starter Thread starter Seth Williams
  • Start date Start date
S

Seth Williams

I've got a Sharepoint website for which the 'big guy' doesn't want to enable
impersonation.

But - I need impersonation for a file list (from another server), so I set
out to do it in code - - I found this on Support.MS.com:
http://support.microsoft.com/?id=306158#XSLTH3167121123120121120120

I use the short portion, to impersonate the Authenticating User in Code.
This works for our regular dev web server, but apparently not in a
Sharepoint website (pointing to it in a Page View Web part)

Is there a way to create code to, instead of using the authenticated user,
use the ASPNet user account?
 
I've got a Sharepoint website for which the 'big guy' doesn't want to enable
impersonation.
...
Is there a way to create code to, instead of using the authenticated user,
use the ASPNet user account?

If impersonation is disabled then the ASP.NET user account will be
used anyway. However if the authentication mode is "Windows" then in
theory the authenticated Users privileges are merged with the ASP.NET
account (or so Microsoft tell us).

HTH
 
My code is below - anyway to change it to the ASPNet user?

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()

I've tried substituting it, in place of User.Identity, but that's not meant
for a string, so, of course, it doesn't work
 
Back
Top