Impersonation in code/Sharepoint

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?
 
S

Stan

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
 
S

Seth Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top